Created
February 27, 2018 12:48
-
-
Save wernerkrauss/8e9ae07e7aac1cc7cc9a0943e63d9655 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class NetwerkstattDataObjectCMSPermissionExtension | |
* | |
* @property ImageGalleryAlbum|ImageGalleryItem|BookingDotComAccommodation|HomePageCategory|HomePageElement|Tag|Webcam|TomasFeatureGroup|TomasService|TomasServiceGroup|TomasServiceProvider|NetwerkstattDataObjectCMSPermissionExtension $owner | |
*/ | |
class NetwerkstattDataObjectCMSPermissionExtension extends DataExtension implements PermissionProvider | |
{ | |
/** | |
* Return a map of permission codes to add to the dropdown shown in the Security section of the CMS. | |
* array( | |
* 'VIEW_SITE' => 'View the site', | |
* ); | |
*/ | |
public function providePermissions() | |
{ | |
return [ | |
'CMS_MANAGE_ITEM' => ['name' => 'Items bearbeiten', 'category' => _t('Permissions.CONTENT_CATEGORY')], | |
'CMS_DELETE_ITEM' => ['name' => 'Items löschen', 'category' => _t('Permissions.CONTENT_CATEGORY')] | |
]; | |
} | |
public function canCreate($member = null) | |
{ | |
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member) || | |
Permission::check('CMS_MANAGE_ITEM', 'any', $member); | |
} | |
public function canView($member = null) | |
{ | |
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member) || | |
Permission::check('CMS_MANAGE_ITEM', 'any', $member); | |
} | |
public function canEdit($member = null) | |
{ | |
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member) || | |
Permission::check('CMS_MANAGE_ITEM', 'any', $member); | |
} | |
public function canDelete($member = null) | |
{ | |
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member) || | |
Permission::check('CMS_DELETE_ITEM', 'any', $member); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment