mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-12 19:11:07 +03:30
change user policy
This commit is contained in:
@@ -14,7 +14,9 @@ class UserPolicy
|
||||
}
|
||||
public function delete(User $User, User $Operator)
|
||||
{
|
||||
if($User->hasRole('Admin') && $Operator->test_results->count() == 0 && $Operator->test_types->count() == 0)
|
||||
if($User->hasRole('Admin') && $Operator->test_results->count() == 0 && $Operator->test_types->count() == 0
|
||||
&& $Operator->items->count() == 0 && $Operator->packages->count() == 0 && $Operator->labels->count() == 0
|
||||
&& $Operator->cycles->count() == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,4 +73,12 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasMany('App\Item');
|
||||
}
|
||||
public function labels()
|
||||
{
|
||||
return $this->hasMany('App\Label');
|
||||
}
|
||||
public function cycles()
|
||||
{
|
||||
return $this->hasMany('App\Cycle');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user