public function testLinkCreateChecksReadOnly()
 {
     $share = new \OC\Share20\Share();
     $share->setPermissions(\OCP\Constants::PERMISSION_READ);
     $this->config->method('getAppValue')->will($this->returnValueMap([['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_upload', 'yes', 'no']]));
     $this->invokePrivate($this->manager, 'linkCreateChecks', [$share]);
 }
示例#2
0
 /**
  * Resolve a group share to a user specific share
  * Thus if the user moved their group share make sure this is properly reflected here.
  *
  * @param Share $share
  * @param IUser $user
  * @return Share Returns the updated share if one was found else return the original share.
  */
 private function resolveGroupShare(Share $share, IUser $user)
 {
     $qb = $this->dbConn->getQueryBuilder();
     $stmt = $qb->select('*')->from('share')->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($user->getUID())))->setMaxResults(1)->execute();
     $data = $stmt->fetch();
     $stmt->closeCursor();
     if ($data !== false) {
         $share->setPermissions((int) $data['permissions']);
         $share->setTarget($data['file_target']);
     }
     return $share;
 }