You are here

function bean_permission in Bean (for Drupal 7) 7

Implements hook_permissions().

1 call to bean_permission()
BeanSetup::addAdminUser in tests/BeanSetup.test
Create an admin user.

File

./bean.module, line 630
Block Entity

Code

function bean_permission() {
  $perms = array(
    'administer bean types' => array(
      'title' => t('Administer block types'),
      'description' => t('Create and delete fields on beans, and set their permissions.'),
    ),
    'administer beans' => array(
      'title' => t('Administer beans'),
      'description' => t('Delete, add, edit and view all beans.'),
    ),
    'access bean overview' => array(
      'title' => t('Access the Bean overview page'),
      'description' => t('Visit !url', array(
        '!url' => "admin/content/blocks",
      )),
    ),
    'edit bean view mode' => array(
      'title' => t('Change the View Mode of the Bean'),
      'description' => t('Ability to change the view mode on the bean form'),
    ),
    'view bean page' => array(
      'title' => t('View Bean page'),
      'description' => t('Visit !url', array(
        '!url' => 'block/< delta >',
      )),
    ),
    'administer bean settings' => array(
      'title' => t('Administer Bean Settings'),
    ),
    'view bean revisions' => array(
      'title' => t('View Bean revisions'),
    ),
  );

  // Add a Permission for each entity type.
  bean_reset(TRUE);
  foreach (bean_get_types() as $bean_type) {
    $bean_type_name = check_plain($bean_type->type);
    $perms += array(
      "create any {$bean_type_name} bean" => array(
        'title' => t('%type_name: Add Bean', array(
          '%type_name' => $bean_type
            ->getLabel(),
        )),
      ),
      "edit any {$bean_type_name} bean" => array(
        'title' => t('%type_name: Edit Bean', array(
          '%type_name' => $bean_type
            ->getLabel(),
        )),
      ),
      "view any {$bean_type_name} bean" => array(
        'title' => t('%type_name: View Bean', array(
          '%type_name' => $bean_type
            ->getLabel(),
        )),
      ),
      "delete any {$bean_type_name} bean" => array(
        'title' => t('%type_name: Delete Bean', array(
          '%type_name' => $bean_type
            ->getLabel(),
        )),
      ),
    );
  }
  return $perms;
}