本文整理汇总了PHP中OC_Mount_Config::getAbsoluteMountPoints方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Mount_Config::getAbsoluteMountPoints方法的具体用法?PHP OC_Mount_Config::getAbsoluteMountPoints怎么用?PHP OC_Mount_Config::getAbsoluteMountPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Mount_Config
的用法示例。
在下文中一共展示了OC_Mount_Config::getAbsoluteMountPoints方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserMounts
/**
* Returns the mount points visible for this user.
*
* @param array $params
* @return \OC_OCS_Result share information
*/
public static function getUserMounts($params)
{
$entries = array();
$user = \OC_User::getUser();
$mounts = \OC_Mount_Config::getAbsoluteMountPoints($user);
foreach ($mounts as $mountPoint => $mount) {
$entries[] = self::formatMount($mountPoint, $mount);
}
return new \OC_OCS_Result($entries);
}
示例2: login
/**
* Intercepts the user credentials on login and stores them
* encrypted inside the session if SMB_OC storage is enabled.
* @param array $params
*/
public static function login($params)
{
$mountpoints = \OC_Mount_Config::getAbsoluteMountPoints($params['uid']);
$mountpointClasses = array();
foreach ($mountpoints as $mountpoint) {
$mountpointClasses[$mountpoint['class']] = true;
}
if (isset($mountpointClasses['\\OC\\Files\\Storage\\SMB_OC'])) {
\OC::$server->getSession()->set('smb-credentials', \OC::$server->getCrypto()->encrypt(json_encode($params)));
}
}
示例3: getMountsForUser
/**
* Get all mountpoints applicable for the user
*
* @param \OCP\IUser $user
* @param \OCP\Files\Storage\IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $loader)
{
$mountPoints = \OC_Mount_Config::getAbsoluteMountPoints($user->getUID());
$mounts = array();
foreach ($mountPoints as $mountPoint => $options) {
if (isset($options['options']['objectstore'])) {
$objectClass = $options['options']['objectstore']['class'];
$options['options']['objectstore'] = new $objectClass($options['options']['objectstore']);
}
$mountOptions = isset($options['mountOptions']) ? $options['mountOptions'] : [];
if (isset($options['personal']) && $options['personal']) {
$mounts[] = new PersonalMount($options['class'], $mountPoint, $options['options'], $loader, $mountOptions);
} else {
$mounts[] = new MountPoint($options['class'], $mountPoint, $options['options'], $loader, $mountOptions);
}
}
return $mounts;
}
示例4: saveConfig
/**
* saves mount configuration
*/
private function saveConfig()
{
// we read all mountpoints
$mountPoints = \OC_Mount_Config::getAbsoluteMountPoints(\OCP\User::getUser());
// we use the refresh token as unique ID
$new_refresh_token = json_decode($this->params['hubic_token'], TRUE)['refresh_token'];
foreach ($mountPoints as $mountPoint => $options) {
if ($options['class'] == '\\OC\\Files\\Storage\\Hubic' && json_decode($options['options']['hubic_token'], TRUE)['refresh_token'] == $new_refresh_token) {
$shortMountPoint = end(explode('/', $mountPoint, 4));
if ($options['personal']) {
$mountType = \OC_Mount_Config::MOUNT_TYPE_USER;
$applicable = \OCP\User::getUser();
} else {
$mountType = $options['priority_type'];
$applicable = $options['applicable'];
}
\OC_Mount_Config::addMountPoint($shortMountPoint, $options['class'], $this->params, $mountType, $applicable, $options['personal'], $options['priority']);
break;
}
}
}
示例5: testMultiUserPersonalConfigLoading
public function testMultiUserPersonalConfigLoading()
{
$mountConfig = array('host' => 'somehost', 'user' => 'someuser', 'password' => 'somepassword', 'root' => 'someroot');
// Create personal mount point
$this->assertTrue(OC_Mount_Config::addMountPoint('/ext', '\\OC\\Files\\Storage\\SMB', $mountConfig, OC_Mount_Config::MOUNT_TYPE_USER, self::TEST_USER1, true));
// Ensure other user can read mount points
\OC_User::setUserId(self::TEST_USER2);
$mountPointsMe = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER2);
$mountPointsOther = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER1);
$this->assertEquals(0, count($mountPointsMe));
$this->assertEquals(1, count($mountPointsOther));
$this->assertTrue(isset($mountPointsOther['/' . self::TEST_USER1 . '/files/ext']));
$this->assertEquals('\\OC\\Files\\Storage\\SMB', $mountPointsOther['/' . self::TEST_USER1 . '/files/ext']['class']);
$this->assertEquals($mountConfig, $mountPointsOther['/' . self::TEST_USER1 . '/files/ext']['options']);
}
示例6: foreach
}
//组合获取的mimetype的ID
$mimetypesid = "";
foreach ($mimetypesrow as $val) {
$mimetypesid = $mimetypesid . $val['id'] . ',';
}
$mimetypesid = substr($mimetypesid, 0, strrpos($mimetypesid, ','));
try {
//查询当前数据库中当前用的的本地存储信息
$queryDelFast = \OC_DB::prepare('SELECT * FROM `*PREFIX*storages` WHERE `id` = ?');
$result = $queryDelFast->execute(array("home::" . $_SESSION['user_id']));
$row = $result->fetchRow();
$stoarr[] = $row['numeric_id'];
$locastorage = $row['numeric_id'];
//查询出当前用户的mount信息
$mounts = OC_Mount_Config::getAbsoluteMountPoints($_SESSION['user_id']);
//将mount信息中的storage_id变为数组
foreach ($mounts as $key => $val) {
$stoarr[] = $val['storage_id'];
}
$storagestr = implode(',', $stoarr);
//组合where条件
$where = 'WHERE path NOT LIKE "%thumbnails%" AND storage IN (' . $storagestr . ') AND mimetype IN (' . $mimetypesid . ')';
$queryAllFiles = \OC_DB::prepare('SELECT * FROM `*PREFIX*filecache` ' . $where . ' order by ' . $order);
$result = $queryAllFiles->execute();
$row = $result->fetchAll();
} catch (\Exception $e) {
\OCP\Util::writeLog('filefilter', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
return false;
}
$files = $row;
示例7: testMount
/**
* Test mount points used at mount time, making sure
* the configuration is prepared properly.
*
* @dataProvider mountDataProvider
* @param bool $isPersonal true for personal mount point, false for system mount point
* @param string $mountType mount type
* @param string $applicable target user/group or "all"
* @param string $testUser user for which to retrieve the mount points
* @param bool $expectVisible whether to expect the mount point to be visible for $testUser
*/
public function testMount($isPersonal, $mountType, $applicable, $testUser, $expectVisible)
{
$mountConfig = array('host' => 'someost', 'user' => 'someuser', 'password' => 'somepassword', 'root' => 'someroot');
// add mount point as "test" user
$this->assertTrue(OC_Mount_Config::addMountPoint('/ext', '\\OC\\Files\\Storage\\SMB', $mountConfig, $mountType, $applicable, $isPersonal));
// check mount points in the perspective of user $testUser
\OC_User::setUserId($testUser);
$mountPoints = OC_Mount_Config::getAbsoluteMountPoints($testUser);
if ($expectVisible) {
$this->assertEquals(1, count($mountPoints));
$this->assertTrue(isset($mountPoints['/' . self::TEST_USER1 . '/files/ext']));
$this->assertEquals('\\OC\\Files\\Storage\\SMB', $mountPoints['/' . self::TEST_USER1 . '/files/ext']['class']);
$this->assertEquals($mountConfig, $mountPoints['/' . self::TEST_USER1 . '/files/ext']['options']);
} else {
$this->assertEquals(0, count($mountPoints));
}
}
示例8: testPriorityPersistence
/**
* Test for persistence of priority when changing mount options
*/
public function testPriorityPersistence()
{
$class = '\\OC\\Files\\Storage\\SMB';
$priority = 123;
$mountConfig = array('host' => 'somehost', 'user' => 'someuser', 'password' => 'somepassword', 'root' => 'someroot');
$this->assertTrue(OC_Mount_Config::addMountPoint('/ext', $class, $mountConfig, OC_Mount_Config::MOUNT_TYPE_USER, self::TEST_USER1, false, $priority));
// Check for correct priority
$mountPoints = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER1);
$this->assertEquals($priority, $mountPoints['/' . self::TEST_USER1 . '/files/ext']['priority']);
// Simulate changed mount options (without priority set)
$this->assertTrue(OC_Mount_Config::addMountPoint('/ext', $class, $mountConfig, OC_Mount_Config::MOUNT_TYPE_USER, self::TEST_USER1, false));
// Check for correct priority
$mountPoints = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER1);
$this->assertEquals($priority, $mountPoints['/' . self::TEST_USER1 . '/files/ext']['priority']);
}