Skip to content

Commit

Permalink
feat: Stringify userId
Browse files Browse the repository at this point in the history
  • Loading branch information
KminekMatej committed Sep 6, 2024
1 parent 1e191a3 commit 7176711
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/module/poll/manager/PollManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ protected function metaMap(BaseModel &$model, $userId = null): void
}
}

$hasVoteRights = empty($model->getVoteRightName()) || $this->user->isAllowed($userId, "USR:{$model->getVoteRightName()}");
$hasAlienVoteRights = !empty($model->getAlienVoteRightName()) && $this->user->isAllowed($userId, "USR:{$model->getAlienVoteRightName()}");
$hasResultRights = empty($model->getResultRightName()) || $this->user->isAllowed($userId, "USR:{$model->getResultRightName()}");
$hasVoteRights = empty($model->getVoteRightName()) || $this->user->isAllowed((string) $userId, "USR:{$model->getVoteRightName()}");
$hasAlienVoteRights = !empty($model->getAlienVoteRightName()) && $this->user->isAllowed((string) $userId, "USR:{$model->getAlienVoteRightName()}");
$hasResultRights = empty($model->getResultRightName()) || $this->user->isAllowed((string) $userId, "USR:{$model->getResultRightName()}");
$resultsCanBeShown = $model->getShowResults() == Poll::RESULTS_ALWAYS ||
($model->getShowResults() == Poll::RESULTS_AFTER_VOTE && $model->getVoted()) ||
($model->getShowResults() == Poll::RESULTS_NEVER && $model->getCreatedById() === $userId) ||
Expand All @@ -142,7 +142,7 @@ protected function metaMap(BaseModel &$model, $userId = null): void

public function canEdit($entity, $userId): bool
{
return $this->user->isAllowed($userId, "SYS:ASK.VOTE_UPDATE");
return $this->user->isAllowed((string) $userId, "SYS:ASK.VOTE_UPDATE");
}

public function canRead($entity, $userId): bool
Expand Down

0 comments on commit 7176711

Please sign in to comment.