当前位置: 首页>>代码示例>>PHP>>正文


PHP Share::getItemsSharedWith方法代码示例

本文整理汇总了PHP中OCP\Share::getItemsSharedWith方法的典型用法代码示例。如果您正苦于以下问题:PHP Share::getItemsSharedWith方法的具体用法?PHP Share::getItemsSharedWith怎么用?PHP Share::getItemsSharedWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Share的用法示例。


在下文中一共展示了Share::getItemsSharedWith方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: all

 /**
  * @brief Returns the list of addressbooks for a specific user.
  * @param string $uid
  * @param boolean $active Only return addressbooks with this $active state, default(=false) is don't care
  * @param boolean $shared Whether to also return shared addressbook. Defaults to true.
  * @return array or false.
  */
 public static function all($uid, $active = false, $shared = true)
 {
     $values = array($uid);
     $active_where = '';
     if ($active) {
         $active_where = ' AND `active` = ?';
         $values[] = 1;
     }
     try {
         $stmt = \OCP\DB::prepare('SELECT * FROM `*PREFIX*contacts_addressbooks` WHERE `userid` = ? ' . $active_where . ' ORDER BY `displayname`');
         $result = $stmt->execute($values);
         if (\OC_DB::isError($result)) {
             \OCP\Util::write('contacts', __METHOD__ . 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
             return false;
         }
     } catch (\Exception $e) {
         \OCP\Util::writeLog('contacts', __METHOD__ . ' exception: ' . $e->getMessage(), \OCP\Util::ERROR);
         \OCP\Util::writeLog('contacts', __METHOD__ . ' uid: ' . $uid, \OCP\Util::DEBUG);
         return false;
     }
     $addressbooks = array();
     while ($row = $result->fetchRow()) {
         $row['permissions'] = \OCP\PERMISSION_ALL;
         $addressbooks[] = $row;
     }
     if ($shared === true) {
         $addressbooks = array_merge($addressbooks, \OCP\Share::getItemsSharedWith('addressbook', Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS));
     }
     if (!$active && !count($addressbooks)) {
         $id = self::addDefault($uid);
         return array(self::find($id));
     }
     return $addressbooks;
 }
开发者ID:nanowish,项目名称:apps,代码行数:41,代码来源:addressbook.php

示例2: getGroups

	/**
	 * @NoAdminRequired
	 */
	public function getGroups() {
		$tags = $this->tags->getTags();

		foreach ($tags as &$tag) {
			try {
				$ids = $this->tags->getIdsForTag($tag['id']);
				$tag['contacts'] = $ids;
				$tag['displayname'] = $this->displayName($tag);
			} catch(\Exception $e) {
				\OCP\Util::writeLog('contacts', __METHOD__ . ', ' . $e->getMessage(), \OCP\Util::ERROR);
			}
		}

		$favorites = $this->tags->getFavorites();

		$shares = \OCP\Share::getItemsSharedWith('addressbook', \OCA\Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS);
		$addressbookShare = new \OCA\Contacts\Share\Addressbook();
		foreach ($shares as $key => $share) {
			$children = $addressbookShare->getChildren($share['id']); // FIXME: This should be cheaper!
			$shares[$key]['length'] = count($children);
		}

		$groups = array(
			'categories' => $tags,
			'favorites' => $favorites,
			'shared' => $shares,
			'lastgroup' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'lastgroup', 'all'),
			'sortorder' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'groupsort', ''),
			);

		return new JSONResponse($groups);
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:35,代码来源:groupcontroller.php

示例3: allCalendars

 /**
  * @brief Returns the list of calendars for a specific user.
  * @param string $uid User ID
  * @param boolean $active Only return calendars with this $active state, default(=false) is don't care
  * @param boolean $bSubscribe  return calendars with this $issubscribe state, default(=true) is don't care
  * @return array
  */
 public static function allCalendars($uid, $active = false, $bSubscribe = true)
 {
     $values = array($uid);
     $active_where = '';
     if ($active === true) {
         $active_where = ' AND `active` = ?';
         $values[] = (int) $active;
     }
     $subscribe_where = '';
     if ($bSubscribe === false) {
         $subscribe_where = ' AND `issubscribe` = ?';
         $values[] = (int) $bSubscribe;
     }
     $stmt = \OCP\DB::prepare('SELECT * FROM `' . App::CldCalendarTable . '` WHERE `userid` = ?' . $active_where . $subscribe_where);
     $result = $stmt->execute($values);
     $calendars = array();
     while ($row = $result->fetchRow()) {
         $row['permissions'] = \OCP\PERMISSION_ALL;
         if ($row['issubscribe']) {
             $row['permissions'] = \OCP\PERMISSION_SHARE;
         }
         $row['description'] = '';
         $row['active'] = (int) $row['active'];
         $calendars[] = $row;
     }
     $calendars = array_merge($calendars, \OCP\Share::getItemsSharedWith(App::SHARECALENDAR, ShareCalendar::FORMAT_CALENDAR));
     \OCP\Util::emitHook('OCA\\CalendarPlus', 'getCalendars', array('calendar' => &$calendars));
     return $calendars;
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:36,代码来源:calendar.php

示例4: allCalendars

 /**
  * @brief Returns the list of calendars for a specific user.
  * @param string $uid User ID
  * @param boolean $active Only return calendars with this $active state, default(=false) is don't care
  * @param boolean $bSubscribe  return calendars with this $issubscribe state, default(=true) is don't care
  * @return array
  */
 public static function allCalendars($uid, $active = false, $bSubscribe = true, $bShared = true)
 {
     $dbObject = \OC::$server->getDb();
     $calendarDB = new CalendarDAO($dbObject, $uid);
     $calendars = $calendarDB->all($active, $bSubscribe);
     if ($bShared === true) {
         $calendars = array_merge($calendars, \OCP\Share::getItemsSharedWith(App::SHARECALENDAR, ShareCalendar::FORMAT_CALENDAR));
     }
     \OCP\Util::emitHook('OCA\\CalendarPlus', 'getCalendars', array('calendar' => &$calendars));
     return $calendars;
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:18,代码来源:calendar.php

示例5: getAddressBooksForUser

 /**
  * {@inheritdoc}
  */
 public function getAddressBooksForUser(array $options = array())
 {
     // workaround for https://github.com/owncloud/core/issues/2814
     $maybeSharedAddressBook = \OCP\Share::getItemsSharedWith('addressbook', Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS);
     foreach ($maybeSharedAddressBook as $sharedAddressbook) {
         if (isset($sharedAddressbook['id'])) {
             $this->addressBooks[$sharedAddressbook['id']] = $sharedAddressbook;
             $this->addressBooks[$sharedAddressbook['id']]['backend'] = $this->name;
         }
     }
     return $this->addressBooks;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:15,代码来源:shared.php

示例6: getGroups

 /**
  * @NoAdminRequired
  */
 public function getGroups()
 {
     $tags = $this->tags->getTags();
     foreach ($tags as &$tag) {
         try {
             $ids = $this->tags->getIdsForTag($tag['name']);
             $tag['contacts'] = $ids;
         } catch (\Exception $e) {
             $this->api->log(__METHOD__ . ' ' . $e->getMessage());
         }
     }
     $favorites = $this->tags->getFavorites();
     $groups = array('categories' => $tags, 'favorites' => $favorites, 'shared' => \OCP\Share::getItemsSharedWith('addressbook', \OCA\Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS), 'lastgroup' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'lastgroup', 'all'), 'sortorder' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'groupsort', ''));
     return new JSONResponse($groups);
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:18,代码来源:groupcontroller.php

示例7: getDirectoryPermissions

 /**
  * get the permissions for all files in a folder
  *
  * @param int $parentId
  * @param string $user
  * @return int[]
  */
 public function getDirectoryPermissions($parentId, $user)
 {
     // Root of the Shared folder
     if ($parentId === -1) {
         return \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_PERMISSIONS);
     }
     $permissions = $this->get($parentId, $user);
     $query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `parent` = ?');
     $result = $query->execute(array($parentId));
     $filePermissions = array();
     while ($row = $result->fetchRow()) {
         $filePermissions[$row['fileid']] = $permissions;
     }
     return $filePermissions;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:22,代码来源:permissions.php

示例8: all

 /**
  * @brief Returns the list of addressbooks for a specific user.
  * @param string $uid
  * @param boolean $active Only return addressbooks with this $active state, default(=false) is don't care
  * @param boolean $shared Whether to also return shared addressbook. Defaults to true.
  * @return array or false.
  */
 public static function all($uid, $active = false, $shared = true, $sync = false)
 {
     $values = array($uid);
     $active_where = '';
     if ($active) {
         $active_where = ' AND `active` = ?';
         $values[] = 1;
     }
     $sqlOrder = '`displayname` ASC';
     if ($sync === true) {
         $sqlOrder = '`sync` DESC';
     }
     try {
         $stmt = \OCP\DB::prepare('SELECT * FROM `' . App::AddrBookTable . '` WHERE `userid` = ? ' . $active_where . ' ORDER BY ' . $sqlOrder);
         $result = $stmt->execute($values);
         if (\OCP\DB::isError($result)) {
             \OCP\Util::write(App::$appname, __METHOD__ . 'DB error: ' . \OCP\DB::getErrorMessage($result), \OCP\Util::ERROR);
             return false;
         }
     } catch (\Exception $e) {
         \OCP\Util::writeLog(App::$appname, __METHOD__ . ' exception: ' . $e->getMessage(), \OCP\Util::ERROR);
         \OCP\Util::writeLog(App::$appname, __METHOD__ . ' uid: ' . $uid, \OCP\Util::DEBUG);
         return false;
     }
     $addressbooks = array();
     while ($row = $result->fetchRow()) {
         $row['permissions'] = \OCP\PERMISSION_ALL;
         $addressbooks[] = $row;
     }
     if ($shared === true) {
         $sharedAddressbooks = \OCP\Share::getItemsSharedWith(App::SHAREADDRESSBOOK, \OCA\ContactsPlus\Share\Backend\Addressbook::FORMAT_ADDRESSBOOKS);
         // workaround for https://github.com/owncloud/core/issues/2814
         foreach ($sharedAddressbooks as $sharedAddressbook) {
             if (isset($sharedAddressbook['id']) && self::find($sharedAddressbook['id'])) {
                 $addressbooks[] = $sharedAddressbook;
             }
         }
     }
     if (!$active && !count($addressbooks)) {
         $id = self::addDefault($uid);
         return array(self::find($id));
     }
     return $addressbooks;
 }
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:51,代码来源:addressbook.php

示例9: testDeleteParentFolder

 /**
  * test deletion of a folder which contains share mount points. Share mount
  * points should be unshared before the folder gets deleted so
  * that the mount point doesn't end up at the trash bin
  */
 function testDeleteParentFolder()
 {
     $status = \OC_App::isEnabled('files_trashbin');
     \OC_App::enable('files_trashbin');
     \OCA\Files_Trashbin\Trashbin::registerHooks();
     OC_FileProxy::register(new OCA\Files\Share\Proxy());
     $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
     $this->assertTrue($fileinfo instanceof \OC\Files\FileInfo);
     \OCP\Share::shareItem('folder', $fileinfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
     // check if user2 can see the shared folder
     $this->assertTrue($view->file_exists($this->folder));
     $foldersShared = \OCP\Share::getItemsSharedWith('folder');
     $this->assertSame(1, count($foldersShared));
     $view->mkdir("localFolder");
     $view->file_put_contents("localFolder/localFile.txt", "local file");
     $view->rename($this->folder, 'localFolder/' . $this->folder);
     // share mount point should now be moved to the subfolder
     $this->assertFalse($view->file_exists($this->folder));
     $this->assertTrue($view->file_exists('localFolder/' . $this->folder));
     $view->unlink('localFolder');
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // shared folder should be unshared
     $foldersShared = \OCP\Share::getItemsSharedWith('folder');
     $this->assertTrue(empty($foldersShared));
     // trashbin should contain the local file but not the mount point
     $rootView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
     $trashContent = \OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_FILES_SHARING_API_USER2);
     $this->assertSame(1, count($trashContent));
     $firstElement = reset($trashContent);
     $timestamp = $firstElement['mtime'];
     $this->assertTrue($rootView->file_exists('files_trashbin/files/localFolder.d' . $timestamp . '/localFile.txt'));
     $this->assertFalse($rootView->file_exists('files_trashbin/files/localFolder.d' . $timestamp . '/' . $this->folder));
     //cleanup
     $rootView->deleteAll('files_trashin');
     if ($status === false) {
         \OC_App::disable('files_trashbin');
     }
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:46,代码来源:updater.php

示例10: testpreUnlink

 /**
  * @medium
  */
 function testpreUnlink()
 {
     $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder);
     $result = \OCP\Share::shareItem('folder', $fileInfo2->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $this->assertTrue($result);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // one folder should be shared with the user
     $sharedFolders = \OCP\Share::getItemsSharedWith('folder');
     $this->assertSame(1, count($sharedFolders));
     // move shared folder to 'localDir'
     \OC\Files\Filesystem::mkdir('localDir');
     $result = \OC\Files\Filesystem::rename($this->folder, '/localDir/' . $this->folder);
     $this->assertTrue($result);
     \OC\Files\Filesystem::unlink('localDir');
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // after the parent directory was deleted the share should be unshared
     $sharedFolders = \OCP\Share::getItemsSharedWith('folder');
     $this->assertTrue(empty($sharedFolders));
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     // the folder for the owner should still exists
     $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
 }
开发者ID:samj1912,项目名称:repo,代码行数:25,代码来源:proxy.php

示例11: getAll

 /**
  * get all file ids on the files on the storage
  *
  * @return int[]
  */
 public function getAll()
 {
     $ids = \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_GET_ALL);
     $folderBackend = \OCP\Share::getBackend('folder');
     if ($folderBackend instanceof Share_Backend_Collection) {
         foreach ($ids as $file) {
             /** @var $folderBackend Share_Backend_Collection */
             $children = $folderBackend->getChildren($file);
             foreach ($children as $child) {
                 $ids[] = (int) $child['source'];
             }
         }
     }
     return $ids;
 }
开发者ID:Combustible,项目名称:core,代码行数:20,代码来源:cache.php

示例12: testShareWithUser


//.........这里部分代码省略.........
     }
     // Unshare
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2));
     // Attempt reshare without share permission
     $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
     \OC_User::setUserId($this->user2);
     $message = 'Sharing test.txt failed, because resharing is not allowed';
     try {
         \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ);
         $this->fail('Exception was expected: ' . $message);
     } catch (\Exception $exception) {
         $this->assertEquals($message, $exception->getMessage());
     }
     // Owner grants share and update permission
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE));
     // Attempt reshare with escalated permissions
     \OC_User::setUserId($this->user2);
     $message = 'Sharing test.txt failed, because the permissions exceed permissions granted to ' . $this->user2;
     try {
         \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
         $this->fail('Exception was expected: ' . $message);
     } catch (\Exception $exception) {
         $this->assertEquals($message, $exception->getMessage());
     }
     // Valid reshare
     $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE));
     $this->assertEquals(array('test.txt'), \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE));
     \OC_User::setUserId($this->user3);
     $this->assertEquals(array('test.txt'), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE));
     $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
     // Attempt to escalate permissions
     \OC_User::setUserId($this->user2);
     $message = 'Setting permissions for test.txt failed, because the permissions exceed permissions granted to ' . $this->user2;
     try {
         \OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
         $this->fail('Exception was expected: ' . $message);
     } catch (\Exception $exception) {
         $this->assertEquals($message, $exception->getMessage());
     }
     // Remove update permission
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
     \OC_User::setUserId($this->user2);
     $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
     \OC_User::setUserId($this->user3);
     $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
     // Remove share permission
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
     \OC_User::setUserId($this->user2);
     $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
     \OC_User::setUserId($this->user3);
     $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt'));
     // Reshare again, and then have owner unshare
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
     \OC_User::setUserId($this->user2);
     $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ));
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2));
     \OC_User::setUserId($this->user2);
     $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt'));
     \OC_User::setUserId($this->user3);
     $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt'));
     // Attempt target conflict
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
     \OC_User::setUserId($this->user3);
     $this->assertTrue(\OCP\Share::shareItem('test', 'share.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
     \OC_User::setUserId($this->user2);
     $to_test = \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET);
     $this->assertEquals(2, count($to_test));
     $this->assertTrue(in_array('test.txt', $to_test));
     $this->assertTrue(in_array('test1.txt', $to_test));
     // Unshare from self
     $this->assertTrue(\OCP\Share::unshareFromSelf('test', 'test.txt'));
     $this->assertEquals(array('test1.txt'), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET));
     // Unshare from self via source
     $this->assertTrue(\OCP\Share::unshareFromSelf('test', 'share.txt', true));
     $this->assertEquals(array(), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET));
     \OC_User::setUserId($this->user1);
     $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
     \OC_User::setUserId($this->user3);
     $this->assertTrue(\OCP\Share::shareItem('test', 'share.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
     \OC_User::setUserId($this->user2);
     $to_test = \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET);
     $this->assertEquals(2, count($to_test));
     $this->assertTrue(in_array('test.txt', $to_test));
     $this->assertTrue(in_array('test1.txt', $to_test));
     // Remove user
     \OC_User::setUserId($this->user1);
     $user = \OC::$server->getUserManager()->get($this->user1);
     if ($user !== null) {
         $user->delete();
     }
     \OC_User::setUserId($this->user2);
     $this->assertEquals(array('test1.txt'), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET));
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:101,代码来源:ShareTest.php

示例13: getFilesSharedWithMe

 /**
  * get files shared with the user
  * @return \OC_OCS_Result
  */
 private static function getFilesSharedWithMe()
 {
     try {
         $shares = \OCP\Share::getItemsSharedWith('file');
         foreach ($shares as &$share) {
             if ($share['item_type'] === 'file') {
                 $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']);
                 if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
                     $share['isPreviewAvailable'] = true;
                 }
             }
         }
         $result = new \OC_OCS_Result($shares);
     } catch (\Exception $e) {
         $result = new \OC_OCS_Result(null, 403, $e->getMessage());
     }
     return $result;
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:22,代码来源:local.php

示例14: setup

 public static function setup($options)
 {
     $shares = \OCP\Share::getItemsSharedWith('file');
     $manager = Filesystem::getMountManager();
     $loader = Filesystem::getLoader();
     if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || $shares) {
         foreach ($shares as $share) {
             // don't mount shares where we have no permissions
             if ($share['permissions'] > 0) {
                 $mount = new SharedMount('\\OC\\Files\\Storage\\Shared', $options['user_dir'] . '/' . $share['file_target'], array('share' => $share), $loader);
                 $manager->addMount($mount);
             }
         }
     }
 }
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:15,代码来源:sharedstorage.php

示例15: getAll

 /**
  * get all file ids on the files on the storage
  *
  * @return int[]
  */
 public function getAll()
 {
     return \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_GET_ALL);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:9,代码来源:cache.php


注:本文中的OCP\Share::getItemsSharedWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。