class LicensePermissionProvider in Commerce License 8.2
Provides permissions for the License entity.
This makes a few minor changes to the permissions provided by Entity module's generic permissions provider.
Hierarchy
- class \Drupal\entity\EntityPermissionProviderBase implements EntityHandlerInterface, EntityPermissionProviderInterface uses StringTranslationTrait
- class \Drupal\entity\UncacheableEntityPermissionProvider
- class \Drupal\commerce_license\LicensePermissionProvider
- class \Drupal\entity\UncacheableEntityPermissionProvider
Expanded class hierarchy of LicensePermissionProvider
File
- src/
LicensePermissionProvider.php, line 14
Namespace
Drupal\commerce_licenseView source
class LicensePermissionProvider extends UncacheableEntityPermissionProvider {
/**
* {@inheritdoc}
*/
public function buildPermissions(EntityTypeInterface $entity_type) {
$permissions = parent::buildPermissions($entity_type);
$entity_type_id = $entity_type
->id();
// Mark the 'overview' permission as restricted.
$permissions["access {$entity_type_id} overview"]['restrict access'] = TRUE;
// Add a description to the 'create' to make it clear that it only covers
// admin creation, not creation via product purchase.
$permissions["create {$entity_type_id}"]['description'] = $this
->t('Create licenses in administrative mode, bypassing the purchase of a product.');
return $permissions;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityPermissionProviderBase:: |
protected | property | The entity type bundle info. | |
EntityPermissionProviderBase:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: |
|
EntityPermissionProviderBase:: |
protected | function | Adds the provider and converts the titles to strings to allow sorting. | |
EntityPermissionProviderBase:: |
public | function | Constructs a new EntityPermissionProvider object. | |
LicensePermissionProvider:: |
public | function |
Builds permissions for the given entity type. Overrides EntityPermissionProviderBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UncacheableEntityPermissionProvider:: |
protected | function |
Builds permissions for the bundle granularity. Overrides EntityPermissionProviderBase:: |
|
UncacheableEntityPermissionProvider:: |
protected | function |
Builds permissions for the entity_type granularity. Overrides EntityPermissionProviderBase:: |