public function panels_display::access in Panels 7.3
Determine if the given user can perform the requested operation.
Parameters
string $op: An operation like: create, read, update, or delete.
object $account: (optional) The account to check access for.
Return value
bool TRUE if access is granted; otherwise FALSE.
File
- ./
panels.module, line 904 - Core functionality for the Panels engine.
Class
- panels_display
- Forms the basis of a panel display.
Code
public function access($op, $account = NULL) {
global $user;
if (!$account) {
$account = $user;
}
// Even administrators need to go through the access system. However, to
// support legacy plugins, user 1 gets full access no matter what.
if ($account->uid == 1) {
return TRUE;
}
if (!in_array($op, array(
'create',
'read',
'update',
'delete',
'change layout',
))) {
return FALSE;
}
if (empty($this->storage_type) || empty($this->storage_id)) {
return FALSE;
}
if ($this->storage_type == 'unknown') {
return FALSE;
}
$storage_plugin = panels_get_panels_storage_plugin($this->storage_type);
if (!$storage_plugin) {
return FALSE;
}
$access_callback = panels_plugin_get_function('panels_storage', $storage_plugin, 'access callback');
if (!$access_callback) {
return FALSE;
}
return $access_callback($this->storage_type, $this->storage_id, $op, $account);
}