diff options
-rw-r--r-- | lib/Model/Acl.php | 12 | ||||
-rw-r--r-- | lib/Service/PollService.php | 8 | ||||
-rw-r--r-- | src/js/components/VoteTable/VoteTable.vue | 3 | ||||
-rw-r--r-- | src/js/views/Vote.vue | 2 |
4 files changed, 15 insertions, 10 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); diff --git a/src/js/components/VoteTable/VoteTable.vue b/src/js/components/VoteTable/VoteTable.vue index 6dcc7371..32f804ab 100644 --- a/src/js/components/VoteTable/VoteTable.vue +++ b/src/js/components/VoteTable/VoteTable.vue @@ -45,7 +45,7 @@ <Confirmation v-if="option.confirmed && closed" :option="option" /> - <Counter v-else :show-maybe="!!poll.allowMaybe" + <Counter v-else-if="acl.allowSeeResults" :show-maybe="!!poll.allowMaybe" :option="option" :counter-style="viewMode === 'table-view' ? 'iconStyle' : 'barStyle'" :show-no="viewMode === 'list-view'" /> @@ -134,6 +134,7 @@ export default { }), ...mapGetters({ + hideResults: 'poll/hideResults', closed: 'poll/closed', participants: 'poll/participants', }), diff --git a/src/js/views/Vote.vue b/src/js/views/Vote.vue index 1c1dd971..72b35a3e 100644 --- a/src/js/views/Vote.vue +++ b/src/js/views/Vote.vue @@ -86,7 +86,7 @@ <div class="area__footer"> <PublicEmail v-if="showEmailEdit" :value="share.emailAddress" @update="submitEmailAddress" /> <Subscription v-if="acl.allowSubscribe" /> - <ParticipantsList v-if="acl.allowSeeUsernames" /> + <ParticipantsList v-if="acl.allowSeeUsernames && acl.AllowSeeResults" /> </div> <PublicRegisterModal v-if="showRegisterModal" /> |