diff options
author | Andreas Gohr <andi@splitbrain.org> | 2014-01-05 19:09:34 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2014-01-05 19:09:34 +0100 |
commit | c17acc9f11cd61909a9395b560e759686c7717e6 (patch) | |
tree | d4e9132d6175c5ebc2f1848e73e63b2f8e374c69 | |
parent | dfaf5f6c54597f81b1a8b777f55b89c93f87a345 (diff) | |
download | rpg-c17acc9f11cd61909a9395b560e759686c7717e6.tar.gz rpg-c17acc9f11cd61909a9395b560e759686c7717e6.tar.bz2 |
AUTH_ACL_CHECK event around ACL checking
allows to modify ACL results in the AFTER event or to implement a
completely different ACL mechanism in the BEFORE event.
-rw-r--r-- | inc/auth.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/inc/auth.php b/inc/auth.php index b793f5d12..6000ea6d7 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -661,17 +661,39 @@ function auth_quickaclcheck($id) { } /** - * Returns the maximum rights a user has for - * the given ID or its namespace + * Returns the maximum rights a user has for the given ID or its namespace * * @author Andreas Gohr <andi@splitbrain.org> - * + * @triggers AUTH_ACL_CHECK * @param string $id page ID (needs to be resolved and cleaned) * @param string $user Username * @param array|null $groups Array of groups the user is in * @return int permission level */ function auth_aclcheck($id, $user, $groups) { + $data = array( + 'id' => $id, + 'user' => $user, + 'groups' => $groups + ); + + return trigger_event('AUTH_ACL_CHECK', $data, 'auth_aclcheck_cb'); +} + +/** + * default ACL check method + * + * DO NOT CALL DIRECTLY, use auth_aclcheck() instead + * + * @author Andreas Gohr <andi@splitbrain.org> + * @param array $data event data + * @return int permission level + */ +function auth_aclcheck_cb($data) { + $id =& $data['id']; + $user =& $data['user']; + $groups =& $data['groups']; + global $conf; global $AUTH_ACL; /* @var DokuWiki_Auth_Plugin $auth */ |