| @@ 53-71 (lines=19) @@ | ||
| 50 | * @return Member |
|
| 51 | * @throws MemberDoesNotExistException |
|
| 52 | */ |
|
| 53 | public function forceGetMember($circleUniqueId, $userId, $type) { |
|
| 54 | $qb = $this->getMembersSelectSql(); |
|
| 55 | ||
| 56 | $this->limitToUserId($qb, $userId); |
|
| 57 | $this->limitToUserType($qb, $type); |
|
| 58 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 59 | ||
| 60 | $cursor = $qb->execute(); |
|
| 61 | $data = $cursor->fetch(); |
|
| 62 | $cursor->closeCursor(); |
|
| 63 | ||
| 64 | if ($data === false) { |
|
| 65 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 66 | } |
|
| 67 | ||
| 68 | $member = $this->parseMembersSelectSql($data); |
|
| 69 | ||
| 70 | return $member; |
|
| 71 | } |
|
| 72 | ||
| 73 | ||
| 74 | /** |
|
| @@ 174-190 (lines=17) @@ | ||
| 171 | * @return Member |
|
| 172 | * @throws MemberDoesNotExistException |
|
| 173 | */ |
|
| 174 | public function forceGetGroup($circleUniqueId, $groupId) { |
|
| 175 | $qb = $this->getGroupsSelectSql(); |
|
| 176 | ||
| 177 | $this->limitToGroupId($qb, $groupId); |
|
| 178 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 179 | ||
| 180 | $cursor = $qb->execute(); |
|
| 181 | $data = $cursor->fetch(); |
|
| 182 | if ($data === false) { |
|
| 183 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 184 | } |
|
| 185 | ||
| 186 | $group = $this->parseGroupsSelectSql($data); |
|
| 187 | $cursor->closeCursor(); |
|
| 188 | ||
| 189 | return $group; |
|
| 190 | } |
|
| 191 | ||
| 192 | ||
| 193 | /** |
|
| @@ 44-61 (lines=18) @@ | ||
| 41 | * @return SharingFrame |
|
| 42 | * @throws SharingFrameDoesNotExistException |
|
| 43 | */ |
|
| 44 | public function getSharingFrame($circleUniqueId, $frameUniqueId) { |
|
| 45 | $qb = $this->getSharesSelectSql(); |
|
| 46 | $this->limitToUniqueId($qb, $frameUniqueId); |
|
| 47 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 48 | $this->leftJoinCircle($qb); |
|
| 49 | ||
| 50 | $cursor = $qb->execute(); |
|
| 51 | $data = $cursor->fetch(); |
|
| 52 | $cursor->closeCursor(); |
|
| 53 | ||
| 54 | if ($data === false) { |
|
| 55 | throw new SharingFrameDoesNotExistException($this->l10n->t('Sharing Frame does not exist')); |
|
| 56 | } |
|
| 57 | ||
| 58 | $entry = $this->parseSharesSelectSql($data); |
|
| 59 | ||
| 60 | return $entry; |
|
| 61 | } |
|
| 62 | ||
| 63 | ||
| 64 | /** |
|
| @@ 80-94 (lines=15) @@ | ||
| 77 | * @return SharesToken |
|
| 78 | * @throws TokenDoesNotExistException |
|
| 79 | */ |
|
| 80 | public function getTokenFromMember(string $shareId, string $circleId, string $email) { |
|
| 81 | $qb = $this->getTokensSelectSql(); |
|
| 82 | $this->limitToShareId($qb, $shareId); |
|
| 83 | $this->limitToUserId($qb, $email); |
|
| 84 | $this->limitToCircleId($qb, $circleId); |
|
| 85 | ||
| 86 | $cursor = $qb->execute(); |
|
| 87 | $data = $cursor->fetch(); |
|
| 88 | $cursor->closeCursor(); |
|
| 89 | if ($data === false) { |
|
| 90 | throw new TokenDoesNotExistException('Unknown share token'); |
|
| 91 | } |
|
| 92 | ||
| 93 | return $this->parseTokensSelectSql($data); |
|
| 94 | } |
|
| 95 | ||
| 96 | ||
| 97 | /** |
|