You are here

function tmgmt_message_access in Translation Management Tool 7

Access callback for the job message entity.

Parameters

$op: The operation being performed.

$item: (Optional) A TMGMTJobMessage entity to check access for. If no entity is given, it will be determined whether access is allowed for all entities.

$account: (Optional) The user to check for. Leave it to NULL to check for the global user.

Return value

boolean TRUE if access is allowed, FALSE otherwise.

Related topics

1 string reference to 'tmgmt_message_access'
tmgmt_entity_info in ./tmgmt.module
Implements hook_entity_info().

File

./tmgmt.module, line 681
Main module file for the Translation Management module.

Code

function tmgmt_message_access($op, TMGMTMessage $message = NULL, $account = NULL) {

  // All users that can see jobs can see messages as well.
  if ($op == 'view') {
    $job = NULL;
    if ($message) {
      $job = $message
        ->getJob();
    }
    return tmgmt_job_access('view', $job, $account);
  }

  // Changing or creating messages is only possible for admins.
  return user_access('administer tmgmt');
}