Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Model/Acl.php')
-rw-r--r--lib/Model/Acl.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Model/Acl.php b/lib/Model/Acl.php
index 2c42980a..ebc998f2 100644
--- a/lib/Model/Acl.php
+++ b/lib/Model/Acl.php
@@ -136,6 +136,37 @@ class Acl implements JsonSerializable {
}
}
+
+ /**
+ * @NoAdminRequired
+ * @return boolean
+ */
+ public function setPollIdOrToken($pollId = 0, $token = '') {
+
+ if ($token) {
+ $this->setToken($token);
+ } elseif ($pollId) {
+ $this->setPollId($pollId);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @NoAdminRequired
+ * @return boolean
+ */
+ public function checkAuthorize($pollId = 0, $token = '') {
+
+ if ($token) {
+ $this->setToken($token);
+ } elseif ($pollId) {
+ $this->setPollId($pollId);
+ }
+
+ return ($this->userId && $this->poll->getId());
+ }
+
/**
* @NoAdminRequired
* @return string
@@ -372,12 +403,14 @@ class Acl implements JsonSerializable {
* @return string
*/
public function setToken(string $token): Acl {
+ $this->logger->debug('Share PollId' . $token);
try {
$this->token = $token;
$share = $this->shareMapper->findByToken($token);
$this->foundByToken = true;
$this->setPollId($share->getPollId());
+ $this->logger->debug('Share PollId' . $share->getPollId());
if (($share->getType() === 'group' || $share->getType() === 'user') && !\OC::$server->getUserSession()->isLoggedIn()) {
// User must be logged in for shareType user and group