You are here

function file_service_get_access in Services 6

Same name and namespace in other branches
  1. 6.2 services/file_service/file_service.inc \file_service_get_access()
  2. 7 services/file_service/file_service.inc \file_service_get_access()

Check if the user has permission to get a given file

1 string reference to 'file_service_get_access'
file_service_service in services/file_service/file_service.module
Implementation of hook_service().

File

services/file_service/file_service.inc, line 32
@author Services Dev Team

Code

function file_service_get_access($fid) {
  global $user;
  if (user_access('get any binary files')) {
    return TRUE;
  }
  elseif ($file = db_fetch_array(db_query('SELECT * FROM {files} WHERE fid = %d', $fid))) {
    return $file['uid'] == $user->uid and user_access('get own binary files');
  }
}