function flag_flag::user_access in Flag 6
Same name and namespace in other branches
- 5 flag.inc \flag_flag::user_access()
- 6.2 flag.inc \flag_flag::user_access()
- 7.3 includes/flag/flag_flag.inc \flag_flag::user_access()
- 7.2 flag.inc \flag_flag::user_access()
Returns TRUE if user has access to use this flag.
Parameters
$account: Optional. The user object. If none given, the current user will be used.
Return value
Boolean TRUE if the user is allowed to flag/unflag. FALSE otherwise.
1 call to flag_flag::user_access()
- flag_flag::flag in ./
flag.inc - Flags, on unflags, an item.
File
- ./
flag.inc, line 342 - Implements various flags. Uses object oriented style inspired by that of Views 2.
Class
- flag_flag
- This abstract class represents a flag, or, in Views 2 terminology, "a handler".
Code
function user_access($account = NULL) {
if (!isset($account)) {
$account = $GLOBALS['user'];
}
$matched_roles = array_intersect($this->roles, array_keys($account->roles));
return !empty($matched_roles) || empty($this->roles) || $account->uid == 1;
}