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


PHP OC_Mount_Config::addMountPoint方法代码示例

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


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

示例1: testAddMountPointValidation

 /**
  * Test mount point validation
  */
 public function testAddMountPointValidation()
 {
     $storageClass = 'Test_Mount_Config_Dummy_Storage';
     $mountType = 'user';
     $applicable = 'all';
     $isPersonal = false;
     $this->assertEquals(false, OC_Mount_Config::addMountPoint('', $storageClass, array(), $mountType, $applicable, $isPersonal));
     $this->assertEquals(false, OC_Mount_Config::addMountPoint('/', $storageClass, array(), $mountType, $applicable, $isPersonal));
     $this->assertEquals(false, OC_Mount_Config::addMountPoint('Shared', $storageClass, array(), $mountType, $applicable, $isPersonal));
     $this->assertEquals(false, OC_Mount_Config::addMountPoint('/Shared', $storageClass, array(), $mountType, $applicable, $isPersonal));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:14,代码来源:mountconfig.php

示例2: array

<?php

OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::callCheck();
if ($_POST['isPersonal'] == 'true') {
    OCP\JSON::checkLoggedIn();
    $isPersonal = true;
} else {
    OCP\JSON::checkAdminUser();
    $isPersonal = false;
}
$mountPoint = (string) $_POST['mountPoint'];
$oldMountPoint = (string) $_POST['oldMountPoint'];
$class = (string) $_POST['class'];
$options = (string) $_POST['classOptions'];
$type = (string) $_POST['mountType'];
$applicable = (string) $_POST['applicable'];
if ($oldMountPoint and $oldMountPoint !== $mountPoint) {
    OC_Mount_Config::removeMountPoint($oldMountPoint, $type, $applicable, $isPersonal);
}
$status = OC_Mount_Config::addMountPoint($mountPoint, $class, $options, $type, $applicable, $isPersonal);
OCP\JSON::success(array('data' => array('message' => $status)));
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:22,代码来源:addMountPoint.php

示例3: 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']);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:15,代码来源:mountconfig.php

示例4:

<?php

OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::callCheck();
if ($_POST['isPersonal'] == 'true') {
    OCP\JSON::checkLoggedIn();
    $isPersonal = true;
} else {
    OCP\JSON::checkAdminUser();
    $isPersonal = false;
}
OC_Mount_Config::addMountPoint($_POST['mountPoint'], $_POST['class'], $_POST['classOptions'], $_POST['mountType'], $_POST['applicable'], $isPersonal);
开发者ID:ryanshoover,项目名称:core,代码行数:12,代码来源:addMountPoint.php

示例5: 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));
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:28,代码来源:mountconfig.php

示例6: 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']);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:18,代码来源:mountconfig.php

示例7: testAllowWritingIncompleteConfigIfStorageContructorFails

 public function testAllowWritingIncompleteConfigIfStorageContructorFails()
 {
     $storageClass = 'Test_Mount_Config_Dummy_Storage';
     $mountType = 'user';
     $applicable = 'all';
     $isPersonal = false;
     $this->assertEquals(0, OC_Mount_Config::addMountPoint('/ext', $storageClass, array('simulateFail' => true), $mountType, $applicable, $isPersonal));
     // config can be retrieved afterwards
     $mounts = OC_Mount_Config::getSystemMountPoints();
     $this->assertEquals(1, count($mounts));
     // no storage id was set
     $this->assertFalse(isset($mounts[0]['storage_id']));
 }
开发者ID:samj1912,项目名称:repo,代码行数:13,代码来源:mountconfig.php

示例8: 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;
         }
     }
 }
开发者ID:neteler,项目名称:owncloud-files-hubic,代码行数:24,代码来源:hubic.php


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