añadir nuevas funcionalidades
This commit is contained in:
@@ -12,7 +12,7 @@ class UserPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users');
|
||||
return $user->hasPermissionTo('user.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ class UserPolicy
|
||||
*/
|
||||
public function view(User $user, User $model): bool
|
||||
{
|
||||
return false;
|
||||
return $user->hasPermissionTo('user.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ class UserPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users');
|
||||
return $user->hasPermissionTo('user.create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ class UserPolicy
|
||||
*/
|
||||
public function update(User $user, User $model): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users') && !$model->is_protected;
|
||||
return $user->hasPermissionTo('user.create') && !$model->is_protected;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ class UserPolicy
|
||||
*/
|
||||
public function delete(User $user, User $model): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users')
|
||||
return $user->hasPermissionTo('user.delete')
|
||||
&& !$model->is_protected
|
||||
&& $user->id !== $model->id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user