From e786162814e3b4869345aba5bb04c4f1ffa6ba8a Mon Sep 17 00:00:00 2001 From: Anna Sidwell Date: Fri, 10 Aug 2018 15:38:44 +0100 Subject: [PATCH] Remove 'can' from capability names (closes #4) --- user_capabilities.php | 4 ++-- user_capabilities_controller.php | 4 ++-- user_capabilities_menu.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/user_capabilities.php b/user_capabilities.php index 4a987cc..92f50dd 100644 --- a/user_capabilities.php +++ b/user_capabilities.php @@ -85,8 +85,8 @@ public static function is_db_initialised() { "ALTER TABLE `role_capabilities` ADD CONSTRAINT no_duplicated UNIQUE (roleid, capability)", "ALTER TABLE `user_roles` ADD CONSTRAINT no_duplicated UNIQUE (userid, roleid)", "INSERT INTO `roles` VALUES (NULL, 'Superuser', 'All permissions granted')", - "INSERT INTO `role_capabilities` VALUES (1, 'capabilities_can_edit')", - "INSERT INTO `role_capabilities` VALUES (1, 'capabilities_can_view')" + "INSERT INTO `role_capabilities` VALUES (1, 'capabilities_edit')", + "INSERT INTO `role_capabilities` VALUES (1, 'capabilities_view')" ]; public static function init_db() { diff --git a/user_capabilities_controller.php b/user_capabilities_controller.php index dad5f4c..8d9f052 100644 --- a/user_capabilities_controller.php +++ b/user_capabilities_controller.php @@ -25,7 +25,7 @@ function user_capabilities_controller() { // You need read permissions to access the below URLs // - if (!user_has_capability('capabilities_can_view')) { + if (!user_has_capability('capabilities_view')) { http_response_code(404); return "404 Not Found"; } @@ -44,7 +44,7 @@ function user_capabilities_controller() { // You need write permissions to access the below URLs // - if (!user_has_capability('capabilities_can_edit')) { + if (!user_has_capability('capabilities_edit')) { http_response_code(403); $route->format = "json"; return [ 'message' => 'Permission denied' ]; diff --git a/user_capabilities_menu.php b/user_capabilities_menu.php index 127ff01..eaf4b0e 100644 --- a/user_capabilities_menu.php +++ b/user_capabilities_menu.php @@ -3,7 +3,7 @@ // Make sure we have our capability check function require_once "Modules/user_capabilities/user_capabilities.php"; -if (user_has_capability('capabilities_can_edit')) { +if (user_has_capability('capabilities_edit')) { $menu_dropdown_config[] = [ 'name' => "Capabilities", 'icon' => 'icon-lock',