diff options
author | dartcafe <github@dartcafe.de> | 2020-10-06 00:47:35 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-10-06 00:47:35 +0300 |
commit | 6065df0585e052f837edfa117e45191eda2eb921 (patch) | |
tree | ce27aa92c8faaf90f1f643bc2abd7a2beffaddde /lib/Service/ShareService.php | |
parent | fbbb13af2f52059d11921d78ca16e3cca1adbfa1 (diff) |
fixes
Diffstat (limited to 'lib/Service/ShareService.php')
-rw-r--r-- | lib/Service/ShareService.php | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index dce7ff7a..650b5347 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -123,48 +123,47 @@ class ShareService { } $this->share = new Share(); + $this->share->setPollId($pollId); + $this->share->setInvitationSent(0); + $this->share->setToken(\OC::$server->getSecureRandom()->generate( + 16, + ISecureRandom::CHAR_DIGITS . + ISecureRandom::CHAR_LOWER . + ISecureRandom::CHAR_UPPER + )); - switch ($type) { - case Group::TYPE: - $share = new Group($userId); - break; - case Circle::TYPE: - $share = new Circle($userId); - break; - case Contact::TYPE: - $share = new Contact($userId); - break; - case ContactGroup::TYPE: - $share = new ContactGroup($userId); - break; - case User::TYPE: - $share = new User($userId); - break; - case Email::TYPE: - $share = new Email($userId, $emailAddress); - break; - case UserGroupClass::TYPE_PUBLIC: - break; - default: - throw new InvalidShareType('Invalid share type (' . $type . ')'); - } - $this->share->setPollId($pollId); - if ($type = UserGroupClass::TYPE_PUBLIC) { + if ($type === UserGroupClass::TYPE_PUBLIC) { $this->share->setType(UserGroupClass::TYPE_PUBLIC); } else { + switch ($type) { + case Group::TYPE: + $share = new Group($userId); + break; + case Circle::TYPE: + $share = new Circle($userId); + break; + case Contact::TYPE: + $share = new Contact($userId); + break; + case ContactGroup::TYPE: + $share = new ContactGroup($userId); + break; + case User::TYPE: + $share = new User($userId); + break; + case Email::TYPE: + $share = new Email($userId, $emailAddress); + break; + default: + throw new InvalidShareType('Invalid share type (' . $type . ')'); + } + $this->share->setType($share->getType()); $this->share->setUserId($share->getId()); $this->share->setDisplayName($share->getDisplayName()); $this->share->setUserEmail($share->getEmailAddress()); } - $this->share->setInvitationSent(0); - $this->share->setToken(\OC::$server->getSecureRandom()->generate( - 16, - ISecureRandom::CHAR_DIGITS . - ISecureRandom::CHAR_LOWER . - ISecureRandom::CHAR_UPPER - )); return $this->shareMapper->insert($this->share); } |