From: Alexander Ebert Date: Wed, 7 Aug 2013 14:28:07 +0000 (+0200) Subject: Fixed display of poll participants for guests X-Git-Tag: 2.0.0_Beta_7~57^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c72aab299fb842fb60ac56957dbb750f661a08b5;p=GitHub%2FWoltLab%2FWCF.git Fixed display of poll participants for guests --- diff --git a/com.woltlab.wcf/templates/poll.tpl b/com.woltlab.wcf/templates/poll.tpl index d33fbf93ea..ef272e2c23 100644 --- a/com.woltlab.wcf/templates/poll.tpl +++ b/com.woltlab.wcf/templates/poll.tpl @@ -1,4 +1,4 @@ -{if $__wcf->getUser()->userID && !$__pollLoadedJavaScript|isset} +{if ($__wcf->getUser()->userID || $poll->canSeeResult() || $poll->canViewParticipants()) && !$__pollLoadedJavaScript|isset} {assign var=__pollLoadedJavaScript value=true} {/if} -
+
{$poll->question} {#$poll->votes} @@ -33,13 +33,20 @@
- {if $__wcf->getUser()->userID} + {hascontent}
- - - - - {event name='pollButtons'} + {content} + {if $__wcf->getUser()->userID} + + + + {/if} + {if $poll->canViewParticipants()} + + {/if} + + {event name='pollButtons'} + {/content}
- {/if} + {/hascontent}
\ No newline at end of file diff --git a/wcfsetup/install/files/lib/data/poll/Poll.class.php b/wcfsetup/install/files/lib/data/poll/Poll.class.php index 1f2791a336..71a63723a6 100644 --- a/wcfsetup/install/files/lib/data/poll/Poll.class.php +++ b/wcfsetup/install/files/lib/data/poll/Poll.class.php @@ -165,6 +165,19 @@ class Poll extends DatabaseObject { return false; } + /** + * Returns true if current user can view the participant list. + * + * @return boolean + */ + public function canViewParticipants() { + if ($this->canSeeResult() && $this->isPublic) { + return true; + } + + return false; + } + /** * Sets related object for this poll. * diff --git a/wcfsetup/install/files/lib/data/poll/PollAction.class.php b/wcfsetup/install/files/lib/data/poll/PollAction.class.php index 6e7049ed51..437a97c023 100644 --- a/wcfsetup/install/files/lib/data/poll/PollAction.class.php +++ b/wcfsetup/install/files/lib/data/poll/PollAction.class.php @@ -19,6 +19,11 @@ use wcf\system\WCF; * @category Community Framework */ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserListAction { + /** + * @see wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess + */ + protected $allowGuestAccess = array('getGroupedUserList'); + /** * @see wcf\data\AbstractDatabaseObjectAction::$className */ @@ -245,7 +250,7 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis if (!$this->poll->pollID) { throw new UserInputException('pollID'); } - else if (!$this->poll->isPublic || !$this->poll->canSeeResult()) { + else if (!$this->poll->canViewParticipants()) { throw new PermissionDeniedException(); } }