| @@ 167-172 (lines=6) @@ | ||
| 164 | * Check if file is not already shared with the remote user |
|
| 165 | */ |
|
| 166 | $alreadyShared = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_EMAIL, $share->getNode(), 1, 0); |
|
| 167 | if (!empty($alreadyShared)) { |
|
| 168 | $message = 'Sharing %s failed, this item is already shared with %s'; |
|
| 169 | $message_t = $this->l->t('Sharing %s failed, this item is already shared with %s', array($share->getNode()->getName(), $shareWith)); |
|
| 170 | $this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']); |
|
| 171 | throw new \Exception($message_t); |
|
| 172 | } |
|
| 173 | ||
| 174 | // if the admin enforces a password for all mail shares we create a |
|
| 175 | // random password and send it to the recipient |
|
| @@ 186-191 (lines=6) @@ | ||
| 183 | */ |
|
| 184 | $alreadyShared = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_REMOTE, $share->getNode(), 1, 0); |
|
| 185 | $alreadySharedGroup = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_REMOTE_GROUP, $share->getNode(), 1, 0); |
|
| 186 | if (!empty($alreadyShared) || !empty($alreadySharedGroup)) { |
|
| 187 | $message = 'Sharing %s failed, because this item is already shared with %s'; |
|
| 188 | $message_t = $this->l->t('Sharing %s failed, because this item is already shared with %s', array($share->getNode()->getName(), $shareWith)); |
|
| 189 | $this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']); |
|
| 190 | throw new \Exception($message_t); |
|
| 191 | } |
|
| 192 | ||
| 193 | ||
| 194 | // don't allow federated shares if source and target server are the same |
|