| @@ 9-84 (lines=76) @@ | ||
| 6 | use SilverStripe\Security\Permission; |
|
| 7 | use SilverStripe\Security\PermissionProvider; |
|
| 8 | ||
| 9 | class CareCleaningDoc extends ProductDoc implements PermissionProvider |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @var string |
|
| 13 | */ |
|
| 14 | private static $singular_name = 'Care & Cleaning Doc'; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @var string |
|
| 18 | */ |
|
| 19 | private static $plural_name = 'Care & Cleaning Docs'; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @return FieldList |
|
| 23 | */ |
|
| 24 | public function getCMSFields() |
|
| 25 | { |
|
| 26 | $fields = parent::getCMSFields(); |
|
| 27 | ||
| 28 | $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/CareCleaningDocs'); |
|
| 29 | ||
| 30 | return $fields; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return array |
|
| 35 | */ |
|
| 36 | public function providePermissions() |
|
| 37 | { |
|
| 38 | return array( |
|
| 39 | 'Care_EDIT' => 'Edit Care and Cleaning Docs', |
|
| 40 | 'Care_DELETE' => 'Delete Care and Cleaning Docs', |
|
| 41 | 'Care_CREATE' => 'Create Care and Cleaning Docs', |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param null $member |
|
| 47 | * |
|
| 48 | * @return bool|int |
|
| 49 | */ |
|
| 50 | public function canCreate($member = null, $context = []) |
|
| 51 | { |
|
| 52 | return Permission::check('Care_CREATE', 'any', $member); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @param null $member |
|
| 57 | * |
|
| 58 | * @return bool|int |
|
| 59 | */ |
|
| 60 | public function canEdit($member = null, $context = []) |
|
| 61 | { |
|
| 62 | return Permission::check('Care_EDIT', 'any', $member); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * @param null $member |
|
| 67 | * |
|
| 68 | * @return bool|int |
|
| 69 | */ |
|
| 70 | public function canDelete($member = null, $context = []) |
|
| 71 | { |
|
| 72 | return Permission::check('Care_DELETE', 'any', $member); |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * @param null $member |
|
| 77 | * |
|
| 78 | * @return bool |
|
| 79 | */ |
|
| 80 | public function canView($member = null, $context = []) |
|
| 81 | { |
|
| 82 | return true; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 8-83 (lines=76) @@ | ||
| 5 | use SilverStripe\Security\Permission; |
|
| 6 | use SilverStripe\Security\PermissionProvider; |
|
| 7 | ||
| 8 | class OperationManual extends ProductDoc implements PermissionProvider |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var string |
|
| 12 | */ |
|
| 13 | private static $singular_name = 'Operation Manual'; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @var string |
|
| 17 | */ |
|
| 18 | private static $plural_name = 'OperationManuals'; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @return FieldList |
|
| 22 | */ |
|
| 23 | public function getCMSFields() |
|
| 24 | { |
|
| 25 | $fields = parent::getCMSFields(); |
|
| 26 | ||
| 27 | $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/OperationManuals'); |
|
| 28 | ||
| 29 | return $fields; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @return array |
|
| 34 | */ |
|
| 35 | public function providePermissions() |
|
| 36 | { |
|
| 37 | return array( |
|
| 38 | 'Operation_EDIT' => 'Edit Operation Manuals', |
|
| 39 | 'Operation_DELETE' => 'Delete Operation Manuals', |
|
| 40 | 'Operation_CREATE' => 'Create Operation Manuals', |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @param null $member |
|
| 46 | * |
|
| 47 | * @return bool|int |
|
| 48 | */ |
|
| 49 | public function canCreate($member = null, $context = []) |
|
| 50 | { |
|
| 51 | return Permission::check('Operation_CREATE', 'any', $member); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param null $member |
|
| 56 | * |
|
| 57 | * @return bool|int |
|
| 58 | */ |
|
| 59 | public function canEdit($member = null, $context = []) |
|
| 60 | { |
|
| 61 | return Permission::check('Operation_EDIT', 'any', $member); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @param null $member |
|
| 66 | * |
|
| 67 | * @return bool|int |
|
| 68 | */ |
|
| 69 | public function canDelete($member = null, $context = []) |
|
| 70 | { |
|
| 71 | return Permission::check('Operation_DELETE', 'any', $member); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @param null $member |
|
| 76 | * |
|
| 77 | * @return bool |
|
| 78 | */ |
|
| 79 | public function canView($member = null, $context = []) |
|
| 80 | { |
|
| 81 | return true; |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 8-83 (lines=76) @@ | ||
| 5 | use SilverStripe\Security\Permission; |
|
| 6 | use SilverStripe\Security\PermissionProvider; |
|
| 7 | ||
| 8 | class SpecSheet extends ProductDoc implements PermissionProvider |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var string |
|
| 12 | */ |
|
| 13 | private static $singular_name = 'Spec Sheet'; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @var string |
|
| 17 | */ |
|
| 18 | private static $plural_name = 'Spec Sheets'; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @return FieldList |
|
| 22 | */ |
|
| 23 | public function getCMSFields() |
|
| 24 | { |
|
| 25 | $fields = parent::getCMSFields(); |
|
| 26 | ||
| 27 | $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/SpecSheets'); |
|
| 28 | ||
| 29 | return $fields; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @return array |
|
| 34 | */ |
|
| 35 | public function providePermissions() |
|
| 36 | { |
|
| 37 | return array( |
|
| 38 | 'Spec_EDIT' => 'Edit Spec Sheets', |
|
| 39 | 'Spec_DELETE' => 'Delete Spec Sheets', |
|
| 40 | 'Spec_CREATE' => 'Create Spec Sheets', |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @param null $member |
|
| 46 | * |
|
| 47 | * @return bool|int |
|
| 48 | */ |
|
| 49 | public function canCreate($member = null, $context = []) |
|
| 50 | { |
|
| 51 | return Permission::check('Spec_CREATE', 'any', $member); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param null $member |
|
| 56 | * |
|
| 57 | * @return bool|int |
|
| 58 | */ |
|
| 59 | public function canEdit($member = null, $context = []) |
|
| 60 | { |
|
| 61 | return Permission::check('Spec_EDIT', 'any', $member); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @param null $member |
|
| 66 | * |
|
| 67 | * @return bool|int |
|
| 68 | */ |
|
| 69 | public function canDelete($member = null, $context = []) |
|
| 70 | { |
|
| 71 | return Permission::check('Spec_DELETE', 'any', $member); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @param null $member |
|
| 76 | * |
|
| 77 | * @return bool |
|
| 78 | */ |
|
| 79 | public function canView($member = null, $context = []) |
|
| 80 | { |
|
| 81 | return true; |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 8-83 (lines=76) @@ | ||
| 5 | use SilverStripe\Security\Permission; |
|
| 6 | use SilverStripe\Security\PermissionProvider; |
|
| 7 | ||
| 8 | class Warranty extends ProductDoc implements PermissionProvider |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var string |
|
| 12 | */ |
|
| 13 | private static $singular_name = 'Warranty'; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @var string |
|
| 17 | */ |
|
| 18 | private static $plural_name = 'Warranties'; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @return FieldList |
|
| 22 | */ |
|
| 23 | public function getCMSFields() |
|
| 24 | { |
|
| 25 | $fields = parent::getCMSFields(); |
|
| 26 | ||
| 27 | $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/Warranties'); |
|
| 28 | ||
| 29 | return $fields; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @return array |
|
| 34 | */ |
|
| 35 | public function providePermissions() |
|
| 36 | { |
|
| 37 | return array( |
|
| 38 | 'Warranty_EDIT' => 'Edit Warranty Docs', |
|
| 39 | 'Warranty_DELETE' => 'Delete Warranty Docs', |
|
| 40 | 'Warranty_CREATE' => 'Create Warranty Docs', |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @param null $member |
|
| 46 | * |
|
| 47 | * @return bool|int |
|
| 48 | */ |
|
| 49 | public function canCreate($member = null, $context = []) |
|
| 50 | { |
|
| 51 | return Permission::check('Warranty_CREATE', 'any', $member); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param null $member |
|
| 56 | * |
|
| 57 | * @return bool|int |
|
| 58 | */ |
|
| 59 | public function canEdit($member = null, $context = []) |
|
| 60 | { |
|
| 61 | return Permission::check('Warranty_EDIT', 'any', $member); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @param null $member |
|
| 66 | * |
|
| 67 | * @return bool|int |
|
| 68 | */ |
|
| 69 | public function canDelete($member = null, $context = []) |
|
| 70 | { |
|
| 71 | return Permission::check('Warranty_DELETE', 'any', $member); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @param null $member |
|
| 76 | * |
|
| 77 | * @return bool |
|
| 78 | */ |
|
| 79 | public function canView($member = null, $context = []) |
|
| 80 | { |
|
| 81 | return true; |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||