From 03b2f703294f8095846fb3a94b8766be026f0c1b Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Fri, 10 Feb 2017 15:15:03 -0600 Subject: [PATCH] LocationCategory - permissions closes #133 --- code/objects/LocationCategory.php | 37 ++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/code/objects/LocationCategory.php b/code/objects/LocationCategory.php index 4bc3861..517d4cc 100644 --- a/code/objects/LocationCategory.php +++ b/code/objects/LocationCategory.php @@ -9,7 +9,6 @@ */ class LocationCategory extends DataObject { - /** * @var array */ @@ -35,6 +34,7 @@ class LocationCategory extends DataObject * @var string */ private static $singular_name = 'Category'; + /** * @var string */ @@ -45,4 +45,39 @@ class LocationCategory extends DataObject */ private static $default_sort = 'Name'; + /** + * @param null|Member $member + * @return bool + */ + public function canView($member = null) + { + return true; + } + + /** + * @param null|Member $member + * @return bool|int + */ + public function canEdit($member = null) + { + return Permission::check('Location_EDIT', 'any', $member); + } + + /** + * @param null|Member $member + * @return bool|int + */ + public function canDelete($member = null) + { + return Permission::check('Location_DELETE', 'any', $member); + } + + /** + * @param null|Member $member + * @return bool|int + */ + public function canCreate($member = null) + { + return Permission::check('Location_CREATE', 'any', $member); + } }