no is_system for roles

This commit is contained in:
Ryan Scherler
2020-04-14 13:55:31 -07:00
parent 219cf1bda9
commit 06cc65fe39
2 changed files with 4 additions and 49 deletions
@@ -1,43 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsSystemToRolesTable extends Migration
{
/**
* The name of the table for the migration.
*
* @var string
*/
protected $tableName = 'roles';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table($this->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');
}
});
}
}
+4 -6
View File
@@ -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.'));
}