function file_admin_file_entity_access in File admin 7
Implements hook_file_entity_access().
Restrict view access to file entities based on published status.
File
- ./
file_admin.module, line 76 - Enhances file administration by adding published, promote, and sticky fields.
Code
function file_admin_file_entity_access($op, $file, $account) {
// Deny view access to unpublished files unless the user has "bypass file
// access" permission or has "view own published files" and is the author of
// the file.
if ($op == 'view' && $file->published == FILE_NOT_PUBLISHED && !user_access('view any unpublished files', $account) && !(user_access('view own unpublished files', $account) && $account->uid == $file->uid && $account->uid != 0)) {
return FILE_ENTITY_ACCESS_DENY;
}
return FILE_ENTITY_ACCESS_IGNORE;
}