function entity_legal_document_access in Entity Legal 7
Same name and namespace in other branches
- 7.2 entity_legal.module \entity_legal_document_access()
Access callback for legal documents.
2 string references to 'entity_legal_document_access'
- entity_legal_entity_info in ./
entity_legal.module - Implements hook_entity_info().
- entity_legal_menu in ./
entity_legal.module - Implements hook_menu().
File
- ./
entity_legal.module, line 171 - Entity Legal module.
Code
function entity_legal_document_access($op, $document = NULL) {
// Allow all users who can administer the module to do anything.
if (user_access('administer entity legal')) {
return TRUE;
}
if (is_string($document)) {
$document = entity_load_single(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, $document);
}
// Prevent access if the document is undefined.
if (!$document) {
return FALSE;
}
switch ($op) {
case 'view':
return user_access($document
->getPermissionView());
}
return FALSE;
}