public function access($op, $entity = NULL, $account = NULL)
 {
     if ($op !== 'create' && empty($entity)) {
         return FALSE;
     }
     // The administer permission is a blanket override.
     if (user_access('administer fieldable panels panes')) {
         return TRUE;
     }
     $bundle = is_string($entity) ? $entity : $entity->bundle;
     if ($op == 'create') {
         return user_access('create fieldable ' . $bundle);
     }
     if ($op == 'view') {
         ctools_include('context');
         return ctools_access($entity->view_access, fieldable_panels_panes_get_base_context($entity));
     }
     if ($op == 'update') {
         ctools_include('context');
         return user_access('edit fieldable ' . $bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity));
     }
     if ($op == 'delete') {
         ctools_include('context');
         return user_access('delete fieldable ' . $bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity));
     }
     return FALSE;
 }
 public function access($op, $entity = NULL, $account = NULL)
 {
     if ($op !== 'create' && !$entity) {
         return FALSE;
     }
     // The administer permission is a blanket override.
     if (user_access('administer fieldable panels panes')) {
         return TRUE;
     }
     switch ($op) {
         case 'create':
             return user_access('create fieldable ' . $entity);
         case 'view':
             ctools_include('context');
             return ctools_access($entity->view_access, fieldable_panels_panes_get_base_context($entity));
         case 'update':
             ctools_include('context');
             return user_access('edit fieldable ' . $entity->bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity));
         case 'delete':
             ctools_include('context');
             return user_access('delete fieldable ' . $entity->bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity));
     }
     return FALSE;
 }
 /**
  * Determine if the current user has access to the $panelizer.
  */
 public function access_default_panelizer_object($panelizer)
 {
     // Automatically true for this, regardless of anything else.
     if (user_access('administer panelizer')) {
         return TRUE;
     }
     ctools_include('context');
     return user_access("administer panelizer {$this->entity_type} {$panelizer->panelizer_key} defaults") && ctools_access($panelizer->access, $this->get_contexts($panelizer));
 }
  public function access($op, $entity = NULL, $account = NULL) {
    if ($op !== 'create' && empty($entity)) {
      return FALSE;
    }

    // The administer permission is a blanket override.
    if (user_access('administer fieldable panels panes')) {
      return TRUE;
    }

    // On the first FALSE we return, otherwise we use our own access check.
    foreach (module_invoke_all('fieldable_panels_panes_access', $op, $entity, $account) as $result) {
      if ($result === FALSE) {
        return $result;
      }
    }

    $bundle = is_string($entity) ? $entity : $entity->bundle;

    if ($op == 'create') {
      return user_access('create fieldable ' . $bundle);
    }
    if ($op == 'view') {
      ctools_include('context');
      return ctools_access($entity->view_access, fieldable_panels_panes_get_base_context($entity));
    }
    if ($op == 'update') {
      ctools_include('context');
      return user_access('edit fieldable ' . $bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity));
    }
    if ($op == 'delete') {
      ctools_include('context');
      return user_access('delete fieldable ' . $bundle) && ctools_access($entity->edit_access, fieldable_panels_panes_get_base_context($entity));
    }

    return FALSE;
  }