summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-04 15:42:52 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-04 15:42:52 +0000
commit0d58aae22127f9a1c1b66a5f07e505f70555a954 (patch)
tree08f9b8104eaff656b4ad5703e4406947c046f4d6 /modules/user/user.module
parent510bb1a42f72223cd3dcd7dffa14891c449beca2 (diff)
downloadbrdo-0d58aae22127f9a1c1b66a5f07e505f70555a954.tar.gz
brdo-0d58aae22127f9a1c1b66a5f07e505f70555a954.tar.bz2
#176342 by dmhouse, spatz4000 and Wim Leers: add reset parameter to user_access()
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 4de22e134..e43dc026e 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -429,18 +429,26 @@ function user_password($length = 10) {
* The permission, such as "administer nodes", being checked for.
* @param $account
* (optional) The account to check, if not given use currently logged in user.
+ * @param $reset
+ * (optional) Resets the user's permissions cache, which will result in a
+ * recalculation of the user's permissions. This is necessary to support
+ * dynamically added user roles.
*
* @return
- * boolean TRUE if the current user has the requested permission.
+ * Boolean TRUE if the current user has the requested permission.
*
* All permission checks in Drupal should go through this function. This
* way, we guarantee consistent behavior, and ensure that the superuser
* can perform all actions.
*/
-function user_access($string, $account = NULL) {
+function user_access($string, $account = NULL, $reset = FALSE) {
global $user;
static $perm = array();
+ if ($reset) {
+ unset($perm);
+ }
+
if (is_null($account)) {
$account = $user;
}