You are here

function scald_atom_add_access in Scald: Media Management made easy 7

Access callback for the atom add page.

1 string reference to 'scald_atom_add_access'
scald_menu in ./scald.module
Implements hook_menu().

File

./scald.module, line 2477
The Scald Core, which handles all Scald Registries and dispatch.

Code

function scald_atom_add_access($type = NULL) {

  // If we got a type, check that the user can create atom of this type.
  if (!empty($type)) {
    return scald_action_permitted(new ScaldAtom($type->type), 'create');
  }

  // Otherwise, iterate over our atom types to check if there's one that the
  // current user is allowed to create.
  $types = scald_types();
  foreach ($types as $type) {
    if (scald_action_permitted(new ScaldAtom($type->type), 'create')) {
      return TRUE;
    }
  }
  return FALSE;
}