Full ELMS Learning Network documentation
function file_entity_file_entity_access
×
Error message
User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).cis7 file_entity.module | file_entity_file_entity_access($op, $file, $account) |
cle7 file_entity.module | file_entity_file_entity_access($op, $file, $account) |
elmsmedia7 file_entity.module | file_entity_file_entity_access($op, $file, $account) |
icor7 file_entity.module | file_entity_file_entity_access($op, $file, $account) |
meedjum_blog7 file_entity.module | file_entity_file_entity_access($op, $file, $account) |
mooc7 file_entity.module | file_entity_file_entity_access($op, $file, $account) |
Implements hook_file_entity_access().
Related topics
File
- sites/
all/ modules/ ulmus/ file_entity/ file_entity.module, line 1689 - Extends Drupal file entities to be fieldable and viewable.
Code
function file_entity_file_entity_access($op, $file, $account) {
// If the file URI is invalid, deny access.
if (is_object($file) && !file_valid_uri($file->uri)) {
return FILE_ENTITY_ACCESS_DENY;
}
if ($op == 'create') {
if (user_access('create files')) {
return FILE_ENTITY_ACCESS_ALLOW;
}
}
if (!empty($file)) {
$type = is_string($file) ? $file : $file->type;
if (in_array($type, file_entity_permissions_get_configured_types())) {
if ($op == 'download') {
if (user_access('download any ' . $type . ' files', $account) || is_object($file) && user_access('download own ' . $type . ' files', $account) && ($account->uid == $file->uid)) {
return FILE_ENTITY_ACCESS_ALLOW;
}
}
if ($op == 'update') {
if (user_access('edit any ' . $type . ' files', $account) || (is_object($file) && user_access('edit own ' . $type . ' files', $account) && ($account->uid == $file->uid))) {
return FILE_ENTITY_ACCESS_ALLOW;
}
}
if ($op == 'delete') {
if (user_access('delete any ' . $type . ' files', $account) || (is_object($file) && user_access('delete own ' . $type . ' files', $account) && ($account->uid == $file->uid))) {
return FILE_ENTITY_ACCESS_ALLOW;
}
}
}
}
return FILE_ENTITY_ACCESS_IGNORE;
}