Commit 0d58aae2 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#176342 by dmhouse, spatz4000 and Wim Leers: add reset parameter to user_access()

parent 510bb1a4
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment