function flag_flag::user_access in Flag 7.3
Same name and namespace in other branches
- 5 flag.inc \flag_flag::user_access()
- 6.2 flag.inc \flag_flag::user_access()
- 6 flag.inc \flag_flag::user_access()
- 7.2 flag.inc \flag_flag::user_access()
Determines whether the user has the permission to use this flag.
Parameters
string $action: (optional) The action to test, either "flag" or "unflag". If none given, "flag" will be tested, which is the minimum permission to use a flag.
$account: (optional) The user object. If none given, the current user will be used.
Return value
bool Boolean TRUE if the user is allowed to flag/unflag. FALSE otherwise.
See also
2 calls to flag_flag::user_access()
- flag_flag::access in includes/
flag/ flag_flag.inc - Determines whether the user may flag, or unflag, the given entity.
- flag_flag::access_multiple in includes/
flag/ flag_flag.inc - Determine access to multiple objects.
File
- includes/
flag/ flag_flag.inc, line 444 - Contains the flag_flag class. Flag type classes use an 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($action = 'flag', $account = NULL) {
if (!isset($account)) {
$account = $GLOBALS['user'];
}
// Anonymous user can't use this system unless Session API is installed.
if ($account->uid == 0 && !module_exists('session_api')) {
return FALSE;
}
$permission_string = "{$action} {$this->name}";
return user_access($permission_string, $account);
}