diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Model/Acl.php | 12 | ||||
-rw-r--r-- | lib/Service/PollService.php | 8 |
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/Model/Acl.php b/lib/Model/Acl.php index e001afd0..a8c03dff 100644 --- a/lib/Model/Acl.php +++ b/lib/Model/Acl.php @@ -187,13 +187,9 @@ class Acl implements JsonSerializable { case self::PERMISSION_VOTE: return !$this->poll->getExpired() && $this->share->getType() !== Share::TYPE_PUBLIC; case self::PERMISSION_SEE_RESULTS: - if ($this->getIsOwner()) { - return true; - } elseif ($this->poll->getShowResults() === Poll::SHOW_RESULTS_ALWAYS) { - return true; - } elseif ($this->poll->getShowResults() === Poll::SHOW_RESULTS_CLOSED && $this->poll->getExpired()) { - return true; - } + return $this->getIsOwner() + || $this->poll->getShowResults() === Poll::SHOW_RESULTS_ALWAYS + || $this->poll->getShowResults() === Poll::SHOW_RESULTS_CLOSED && $this->poll->getExpired(); break; case self::PERMISSION_SEE_USERNAMES: return $this->getIsOwner() || !$this->poll->getAnonymous(); @@ -228,6 +224,8 @@ class Acl implements JsonSerializable { 'userHasVoted' => $this->getUserHasVoted(), 'userId' => $this->getUserId(), 'userIsInvolved' => $this->getUserIsInvolved(), + 'pollExpired' => $this->poll->getExpired(), + 'pollExpire' => $this->poll->getExpire(), ]; } diff --git a/lib/Service/PollService.php b/lib/Service/PollService.php index b92dad06..f161affd 100644 --- a/lib/Service/PollService.php +++ b/lib/Service/PollService.php @@ -237,8 +237,14 @@ class PollService { if (isset($poll['title']) && !$poll['title']) { throw new EmptyTitleException('Title must not be empty'); } - $this->poll->deserializeArray($poll); + // Set the expiry time to the actual servertime to avoid an + // expiry misinterpration when using acl + if (isset($poll['expire']) && $poll['expire']) { + $poll['expire'] = time(); + } + + $this->poll->deserializeArray($poll); $this->pollMapper->update($this->poll); $this->watchService->writeUpdate($this->poll->getId(), Watch::OBJECT_POLLS); $this->logService->setLog($this->poll->getId(), Log::MSG_ID_UPDATEPOLL); |