protected function MediaRevisionController::accountHasRevertPermission in Media Revisions UI 2.0.x
Same name and namespace in other branches
- 8 src/Controller/MediaRevisionController.php \Drupal\media_revisions_ui\Controller\MediaRevisionController::accountHasRevertPermission()
Checks if account can revert a given media type.
Parameters
string $mediaType: Media type to check permission.
\Drupal\Core\Session\AccountInterface $account: Account to check for permissions.
Return value
bool TRUE if account can revert a given media type, otherwise FALSE.
1 call to MediaRevisionController::accountHasRevertPermission()
- MediaRevisionController::revisionOverview in src/
Controller/ MediaRevisionController.php - Generates an overview table of older revisions of media.
File
- src/
Controller/ MediaRevisionController.php, line 284
Class
- MediaRevisionController
- Provides a list of media revisions for a given media.
Namespace
Drupal\media_revisions_ui\ControllerCode
protected function accountHasRevertPermission($mediaType, AccountInterface $account) {
$hasRevertPermission = FALSE;
$revertPermissions = [
"revert {$mediaType} media revisions",
'revert all media revisions',
'administer media',
];
foreach ($revertPermissions as $permission) {
if ($account
->hasPermission($permission)) {
$hasRevertPermission = TRUE;
break;
}
}
return $hasRevertPermission;
}