diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-24 16:49:16 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-06-24 16:49:16 +0200 |
commit | 89ed2c37bf656ceb772bb6759c8977a7dc78b3fb (patch) | |
tree | 4a467f829fcc748531cad54e7c08e06dd98d1b7d /apps/federatedfilesharing/lib | |
parent | 654cd18864c943d9ff93c2e6151bb6529fa44513 (diff) | |
download | nextcloud-server-89ed2c37bf656ceb772bb6759c8977a7dc78b3fb.tar.gz nextcloud-server-89ed2c37bf656ceb772bb6759c8977a7dc78b3fb.zip |
Update share type constant usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/federatedfilesharing/lib')
-rw-r--r-- | apps/federatedfilesharing/lib/FederatedShareProvider.php | 12 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php | 14 |
2 files changed, 13 insertions, 13 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 228fab305b9..3cc9c8e58c1 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -171,7 +171,7 @@ class FederatedShareProvider implements IShareProvider { $sharedBy = $share->getSharedBy(); $shareType = $share->getShareType(); - if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP && + if ($shareType === IShare::TYPE_REMOTE_GROUP && !$this->isOutgoingServer2serverGroupShareEnabled() ) { $message = 'It is not allowed to send federated group shares from this server.'; @@ -183,8 +183,8 @@ class FederatedShareProvider implements IShareProvider { /* * Check if file is not already shared with the remote user */ - $alreadyShared = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_REMOTE, $share->getNode(), 1, 0); - $alreadySharedGroup = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_REMOTE_GROUP, $share->getNode(), 1, 0); + $alreadyShared = $this->getSharedWith($shareWith, IShare::TYPE_REMOTE, $share->getNode(), 1, 0); + $alreadySharedGroup = $this->getSharedWith($shareWith, IShare::TYPE_REMOTE_GROUP, $share->getNode(), 1, 0); if (!empty($alreadyShared) || !empty($alreadySharedGroup)) { $message = 'Sharing %1$s failed, because this item is already shared with %2$s'; $message_t = $this->l->t('Sharing %1$s failed, because this item is already shared with %2$s', [$share->getNode()->getName(), $shareWith]); @@ -628,7 +628,7 @@ class FederatedShareProvider implements IShareProvider { $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )) ->andWhere( - $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_REMOTE)) + $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE)) ); /** @@ -945,7 +945,7 @@ class FederatedShareProvider implements IShareProvider { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share') - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_REMOTE))) + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE))) ->andWhere($qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid))) ->execute(); } @@ -1072,7 +1072,7 @@ class FederatedShareProvider implements IShareProvider { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('share_with', 'token', 'file_source') ->from('share') - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_REMOTE))) + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE))) ->andWhere($qb->expr()->in('file_source', $qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY))) ->andWhere($qb->expr()->orX( $qb->expr()->eq('item_type', $qb->createNamedParameter('file')), diff --git a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php index 0e9b9dbed62..d427e324e1f 100644 --- a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php @@ -209,7 +209,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { } // FIXME this should be a method in the user management instead - if ($shareType === Share::SHARE_TYPE_USER) { + if ($shareType === IShare::TYPE_USER) { $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); Util::emitHook( '\OCA\Files_Sharing\API\Server2Server', @@ -225,7 +225,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { \OC_Util::setupFS($shareWith); } - if ($shareType === Share::SHARE_TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) { + if ($shareType === IShare::TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) { throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST); } @@ -247,7 +247,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); - if ($shareType === Share::SHARE_TYPE_USER) { + if ($shareType === IShare::TYPE_USER) { $event = $this->activityManager->generateEvent(); $event->setApp('files_sharing') ->setType('remote_share') @@ -324,9 +324,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { * @return int */ private function mapShareTypeToNextcloud($shareType) { - $result = Share::SHARE_TYPE_USER; + $result = IShare::TYPE_USER; if ($shareType === 'group') { - $result = Share::SHARE_TYPE_GROUP; + $result = IShare::TYPE_GROUP; } return $result; @@ -585,7 +585,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id']))); $qb->execute(); - if ((int)$share['share_type'] === Share::SHARE_TYPE_USER) { + if ((int)$share['share_type'] === IShare::TYPE_USER) { if ($share['accepted']) { $path = trim($mountpoint, '/'); } else { @@ -792,7 +792,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { */ protected function verifyShare(IShare $share, $token) { if ( - $share->getShareType() === FederatedShareProvider::SHARE_TYPE_REMOTE && + $share->getShareType() === IShare::TYPE_REMOTE && $share->getToken() === $token ) { return true; |