canmove, Confirmed users, Bureaucrats and Sysops emeriti
1,043
edits
(info on locale and other special permissions) |
|||
Line 27: | Line 27: | ||
// Check to see if the user has access to the entire Reviewers controller. | // Check to see if the user has access to the entire Reviewers controller. | ||
if ($this->SimpleAcl->actionAllowed('Reviewers','*')) { | if ($this->SimpleAcl->actionAllowed('Reviewers','*')) { | ||
// Do something | |||
} | |||
// Check to see if the user has access to ANY action in the Reviewers controller. | |||
if ($this->SimpleAcl->actionAllowed('Reviewers', '%')) { | |||
// Do something | // Do something | ||
} | } | ||
Normally this would be done in an action. I was not able to use this in a beforeFilter, because that would access member variables and functions not yet loaded. | Normally this would be done in an action. I was not able to use this in a beforeFilter, because that would access member variables and functions not yet loaded. | ||
* [[User:Fligtar|Fligtar]] 03:33, 30 March 2007 (PDT) If you want to use this in beforeFilter, just add this: | |||
$this->SimpleAuth->startup($this); | |||
$this->SimpleAcl->startup($this); | |||
I '''was''' able to use this even when I was in an action that was in the aclExceptions array. | I '''was''' able to use this even when I was in an action that was in the aclExceptions array. | ||
I '''was not''' able to use this when ->enabled=false for SimpleAcl and SimpleAuth. It seems that disabling the components render them useless. So that means that for all-public controllers, if you want to access permission data you'll have to use aclExceptions instead of using the beforeFilter method of turning off permissions. If you don't, you'll get false for all inquiries because the components are disabled. | I '''was not''' able to use this when ->enabled=false for SimpleAcl and SimpleAuth. It seems that disabling the components render them useless. So that means that for all-public controllers, if you want to access permission data you'll have to use aclExceptions instead of using the beforeFilter method of turning off permissions. If you don't, you'll get false for all inquiries because the components are disabled. | ||
* This worked fine for me. [[User:Fligtar|Fligtar]] 03:33, 30 March 2007 (PDT) | |||
== Disabling Permissions in Controllers == | == Disabling Permissions in Controllers == | ||
Line 53: | Line 62: | ||
'''Note''' that when you disable ACLs using this method, you may not manually check permissions because this method essentially disables the components. | '''Note''' that when you disable ACLs using this method, you may not manually check permissions because this method essentially disables the components. | ||
* This worked fine for me. [[User:Fligtar|Fligtar]] 03:33, 30 March 2007 (PDT) | |||
== Special Permissions == | |||
=== Fake Actions === | |||
The following fake actions have been created for use in groups: | |||
* Admin:EditAnyAddon - can edit any add-on as if the owner | |||
* Admin:EditAnyLocale - can edit any locale | |||
=== Locales === | |||
For use with the Localization Control Panel, if you only want a user to be able to VIEW the locale data, you should give permission Localizers:View. If you want him to be able to edit a locale, you should give him Localizers:{locale}, for example Localizers:de. If you want him to be able to edit any locale, give Admin:EditAnyLocale. | |||
== ACL Concerns and Feedback == | == ACL Concerns and Feedback == |