diff options
-rw-r--r-- | modules/user/user.module | 12 |
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; } |