Skip to content

Commit

Permalink
Remove 'can' from capability names (closes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
takkaria committed Aug 10, 2018
1 parent 6cab748 commit e786162
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions user_capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions user_capabilities_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -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' ];
Expand Down
2 changes: 1 addition & 1 deletion user_capabilities_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit e786162

Please sign in to comment.