2

Where can I find a list of Access Arguments to be used with user_access() ? I went to the permissions page and I'm not sure what I can copy and paste from there to be used as an argument for user_access(). So far I only know two: 'access dashboard' and 'access content'

I want to find out how can we get a list of these arguments.

0

1 Answer 1

2

You can get a list of arguments for the site by running this in the terminal:

drush sqlq "select distinct(permission) from role_permission \G"

enter image description here

Make sure you clear cache after making permission adjustments. As my changes weren't showing.

3
  • 1
    Correct me if I'm wrong, isn't the question what is the machine name for all possible permissions? Wouldn't this be better drush sqlq "select distinct(permission) from role_permission \G"
    – tenken
    Commented Feb 25, 2016 at 20:45
  • That's right. I'm not sure how to use distinct. That just shows all the UNIQUE results without duplicates right? Commented Feb 25, 2016 at 20:47
  • yes. Another way to write it would be select distinct permission from role_permission. In mysql distinct() returns all unique rows found in the resultset. it's a nice way to kill your performance. :D but here it's a great solution.
    – tenken
    Commented Feb 25, 2016 at 20:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.