mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
no is_system for roles
This commit is contained in:
@@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user