You are here

function asset_permission in Asset 7

Implements hook_permission().

File

./asset.module, line 201
Asset module.

Code

function asset_permission() {
  $permissions = array(
    'administer asset types' => array(
      'title' => t('Administer asset types'),
      'description' => t('Create, edit and delete types of assets'),
    ),
    'administer assets' => array(
      'title' => t('Administer assets'),
      'description' => t('Create, edit and delete asset entities'),
    ),
    'access asset view page' => array(
      'title' => t('Access asset view page'),
      'description' => t('Has sense only with access content permission'),
    ),
    // We could not simply delete permission because users could rely on it features and etc in old versions of module.
    'access assets overview' => array(
      'title' => t('Access the assets overview page'),
      'description' => t('DEPRECATED! Should not be used.'),
    ),
  );
  foreach (assets_get_types() as $asset) {
    $permissions += array(
      'create asset with type ' . $asset->type => array(
        'title' => t('Create asset with type %asset', array(
          '%asset' => $asset->name,
        )),
      ),
    );
    $permissions += array(
      'edit asset with type ' . $asset->type => array(
        'title' => t('Edit asset with type %asset', array(
          '%asset' => $asset->name,
        )),
      ),
    );
    $permissions += array(
      'delete asset with type ' . $asset->type => array(
        'title' => t('Delete asset with type %asset', array(
          '%asset' => $asset->name,
        )),
      ),
    );
  }
  return $permissions;
}