Skip to content

Commit

Permalink
=
Browse files Browse the repository at this point in the history
  • Loading branch information
Arikaim committed Dec 6, 2022
1 parent 57533e1 commit cce6efa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Models/PermissionRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function deletePermission($name, int $id, string $type = Self::USER): boo
* @param array $access - ['read','write','delete','execute]
* @param integer $id user Id or group Id
* @param integer $type
* @return Model|bool
* @return Model|false
*/
public function setPermission($name, $access, $id, $type = Self::USER)
{
Expand Down
2 changes: 1 addition & 1 deletion Models/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function deleteRoutes(array $filter = []): bool
* @param integer $status
* @return boolean
*/
public function setRoutesStatus(array $filter = [], int $status): bool
public function setRoutesStatus(array $filter, int $status): bool
{
$model = $this;
foreach ($filter as $key => $value) {
Expand Down
10 changes: 3 additions & 7 deletions Models/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,21 +235,17 @@ public function getUserById($id): ?array
*
* @return Model|null
*/
public function getControlPanelUser()
public function getControlPanelUser(): ?object
{
$permisisonId = DbModel::Permissions()->getId(AccessInterface::CONTROL_PANEL);
if ($permisisonId == false) {
return null;
}

$model = DbModel::PermissionRelations();

$model = $model->where('permission_id','=',$permisisonId)->where('relation_type','=','user')->first();
if ($model == null) {
return null;
}

return $this->findById($model->relation_id);

return ($model == null) ? null : $this->findById($model->relation_id);
}

/**
Expand Down

0 comments on commit cce6efa

Please sign in to comment.