diff --git a/database/migrations/2020_04_09_100000_add_is_system_to_roles_table.php b/database/migrations/2020_04_09_100000_add_is_system_to_roles_table.php deleted file mode 100644 index 42b53d3d35..0000000000 --- a/database/migrations/2020_04_09_100000_add_is_system_to_roles_table.php +++ /dev/null @@ -1,43 +0,0 @@ -tableName, function (Blueprint $table) { - if (!Schema::hasColumn($this->tableName, 'is_system')) { - $table->boolean('is_system')->default(0)->after('guard_name'); - } - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table($this->tableName, function (Blueprint $table) { - if (Schema::hasColumn($this->tableName, 'is_system')) { - $table->dropColumn('is_system'); - } - }); - } -} diff --git a/src/Policies/RolePolicy.php b/src/Policies/RolePolicy.php index 7890cba681..2718f40a05 100644 --- a/src/Policies/RolePolicy.php +++ b/src/Policies/RolePolicy.php @@ -23,12 +23,11 @@ class RolePolicy * Determine if the authenticated user can edit a role. * * @param User $authenticated - * @param Role $role * @return bool */ - public function edit($authenticated, $role): Response + public function edit($authenticated): Response { - return !$role->is_system && $authenticated->can('edit roles') + return $authenticated->can('edit roles') ? Response::allow() : Response::deny(__('You are not allowed to edit roles.')); } @@ -50,12 +49,11 @@ class RolePolicy * Determine if the authenticated user can delete a role. * * @param User $authenticated - * @param Role $role * @return bool */ - public function delete($authenticated, $role): Response + public function delete($authenticated): Response { - return !$role->is_system && $authenticated->can('delete roles') + return $authenticated->can('delete roles') ? Response::allow() : Response::deny(__('You are not allowed to delete roles.')); }