feat: 对非超级用户隐藏
This commit is contained in:
parent
858c4d0929
commit
2a43fa0591
@ -27,7 +27,13 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return $this->user->getList();
|
return $this->user->setBeforeGetList(function ($query){
|
||||||
|
if (! $this->getLoginUser()->isSuperAdmin()) {
|
||||||
|
return $query->where('id', '<>', config('catch.super_admin'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
})->getList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +70,13 @@ class User extends Model implements AuthenticatableContract
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function DepartmentId(): Attribute
|
||||||
|
{
|
||||||
|
return new Attribute(
|
||||||
|
get: fn($value) => $value ? : null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is super admin
|
* is super admin
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user