public function registerRoleProvider($role_type, AclRoleProvider $roleProvider) { if (!is_int($role_type)) { throw new \Exception("role_type should be number {$role_type} given"); } if (isset($this->registersRoleProviders[$role_type])) { throw new \Exception("role_type {$role_type} already register"); } $this->registersRoleProviders[$role_type] = $roleProvider; $roleProvider->setRoleType($role_type); $this->registersHooks[$role_type] = []; }
public function removeRole($roleId) { if (Acl::isGuard()) { $authUser = AclUser::find(Auth::id()); if (!in_array($this->role_type, $authUser->user_types)) { return new NoPermissionsException('Only admin user can remove admin roles'); } } return parent::removeRole($roleId); }