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


PHP OC_Mount_Config类代码示例

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


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

示例1: getAccessList

 /**
  * get list of users with access to the file
  *
  * @param string $path to the file
  * @return array
  */
 public function getAccessList($path)
 {
     // Make sure that a share key is generated for the owner too
     list($owner, $ownerPath) = $this->util->getUidAndFilename($path);
     // always add owner to the list of users with access to the file
     $userIds = array($owner);
     if (!$this->util->isFile($ownerPath)) {
         return array('users' => $userIds, 'public' => false);
     }
     $ownerPath = substr($ownerPath, strlen('/files'));
     $ownerPath = $this->util->stripPartialFileExtension($ownerPath);
     // Find out who, if anyone, is sharing the file
     $result = \OCP\Share::getUsersSharingFile($ownerPath, $owner);
     $userIds = \array_merge($userIds, $result['users']);
     $public = $result['public'] || $result['remote'];
     // check if it is a group mount
     if (\OCP\App::isEnabled("files_external")) {
         $mounts = \OC_Mount_Config::getSystemMountPoints();
         foreach ($mounts as $mount) {
             if ($mount['mountpoint'] == substr($ownerPath, 1, strlen($mount['mountpoint']))) {
                 $mountedFor = $this->util->getUserWithAccessToMountPoint($mount['applicable']['users'], $mount['applicable']['groups']);
                 $userIds = array_merge($userIds, $mountedFor);
             }
         }
     }
     // Remove duplicate UIDs
     $uniqueUserIds = array_unique($userIds);
     return array('users' => $uniqueUserIds, 'public' => $public);
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:35,代码来源:file.php

示例2: writeConfig

 /**
  * Write the storages to the configuration.
  *
  * @param array $storages map of storage id to storage config
  */
 public function writeConfig($storages)
 {
     // let the horror begin
     $mountPoints = [];
     foreach ($storages as $storageConfig) {
         $mountPoint = $storageConfig->getMountPoint();
         $oldBackendOptions = $storageConfig->getBackendOptions();
         $storageConfig->setBackendOptions(\OC_Mount_Config::encryptPasswords($oldBackendOptions));
         // system mount
         $rootMountPoint = '/$user/files/' . ltrim($mountPoint, '/');
         $applicableUsers = $storageConfig->getApplicableUsers();
         $applicableGroups = $storageConfig->getApplicableGroups();
         foreach ($applicableUsers as $applicable) {
             $this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_USER, $applicable, $rootMountPoint, $storageConfig);
         }
         foreach ($applicableGroups as $applicable) {
             $this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_GROUP, $applicable, $rootMountPoint, $storageConfig);
         }
         // if neither "applicableGroups" or "applicableUsers" were set, use "all" user
         if (empty($applicableUsers) && empty($applicableGroups)) {
             $this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_USER, 'all', $rootMountPoint, $storageConfig);
         }
         // restore old backend options where the password was not encrypted,
         // because we don't want to change the state of the original object
         $storageConfig->setBackendOptions($oldBackendOptions);
     }
     \OC_Mount_Config::writeData(null, $mountPoints);
 }
开发者ID:samj1912,项目名称:repo,代码行数:33,代码来源:globalstoragesservice.php

示例3: 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);
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:16,代码来源:api.php

示例4: 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

示例5: 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)));
     }
 }
开发者ID:ninjasilicon,项目名称:core,代码行数:16,代码来源:smb_oc.php

示例6: isCertificateImportAllowed

 /**
  * check if certificate import is allowed
  *
  * @return bool
  */
 protected function isCertificateImportAllowed()
 {
     $externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
     if ($externalStorageEnabled) {
         $backends = \OC_Mount_Config::getPersonalBackends();
         if (!empty($backends)) {
             return true;
         }
     }
     return false;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:16,代码来源:certificatecontroller.php

示例7: prepareStorageConfig

 /**
  * Process storage ready for mounting
  *
  * @param StorageConfig $storage
  * @param IUser $user
  */
 private function prepareStorageConfig(StorageConfig &$storage, IUser $user)
 {
     foreach ($storage->getBackendOptions() as $option => $value) {
         $storage->setBackendOption($option, \OC_Mount_Config::setUserVars($user->getUID(), $value));
     }
     $objectStore = $storage->getBackendOption('objectstore');
     if ($objectStore) {
         $objectClass = $objectStore['class'];
         $storage->setBackendOption('objectstore', new $objectClass($objectStore));
     }
     $storage->getAuthMechanism()->manipulateStorageConfig($storage);
     $storage->getBackend()->manipulateStorageConfig($storage);
 }
开发者ID:GrumpyCrouton,项目名称:core,代码行数:19,代码来源:configadapter.php

示例8: validate

 /**
  * Validate storage config
  *
  * @param StorageConfig $storage storage config
  *
  * @return DataResponse|null returns response in case of validation error
  */
 protected function validate(StorageConfig $storage)
 {
     $result = parent::validate($storage);
     if ($result != null) {
         return $result;
     }
     // Verify that the mount point applies for the current user
     // Prevent non-admin users from mounting local storage and other disabled backends
     $allowedBackends = \OC_Mount_Config::getPersonalBackends();
     if (!isset($allowedBackends[$storage->getBackendClass()])) {
         return new DataResponse(array('message' => (string) $this->l10n->t('Invalid storage backend "%s"', array($storage->getBackendClass()))), Http::STATUS_UNPROCESSABLE_ENTITY);
     }
     return null;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:21,代码来源:userstoragescontroller.php

示例9: prepareStorageConfig

 /**
  * Process storage ready for mounting
  *
  * @param StorageConfig $storage
  * @param IUser $user
  */
 private function prepareStorageConfig(StorageConfig &$storage, IUser $user)
 {
     foreach ($storage->getBackendOptions() as $option => $value) {
         $storage->setBackendOption($option, \OC_Mount_Config::setUserVars($user->getUID(), $value));
     }
     $objectStore = $storage->getBackendOption('objectstore');
     if ($objectStore) {
         $objectClass = $objectStore['class'];
         if (!is_subclass_of($objectClass, '\\OCP\\Files\\ObjectStore\\IObjectStore')) {
             throw new \InvalidArgumentException('Invalid object store');
         }
         $storage->setBackendOption('objectstore', new $objectClass($objectStore));
     }
     $storage->getAuthMechanism()->manipulateStorageConfig($storage);
     $storage->getBackend()->manipulateStorageConfig($storage);
 }
开发者ID:hyb148,项目名称:core,代码行数:22,代码来源:configadapter.php

示例10: writeConfig

 /**
  * Write the storages to the user's configuration.
  *
  * @param array $storages map of storage id to storage config
  */
 public function writeConfig($storages)
 {
     $user = $this->userSession->getUser()->getUID();
     // let the horror begin
     $mountPoints = [];
     foreach ($storages as $storageConfig) {
         $mountPoint = $storageConfig->getMountPoint();
         $oldBackendOptions = $storageConfig->getBackendOptions();
         $storageConfig->setBackendOptions(\OC_Mount_Config::encryptPasswords($oldBackendOptions));
         $rootMountPoint = '/' . $user . '/files/' . ltrim($mountPoint, '/');
         $this->addMountPoint($mountPoints, \OC_Mount_Config::MOUNT_TYPE_USER, $user, $rootMountPoint, $storageConfig);
         // restore old backend options where the password was not encrypted,
         // because we don't want to change the state of the original object
         $storageConfig->setBackendOptions($oldBackendOptions);
     }
     \OC_Mount_Config::writeData($user, $mountPoints);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:22,代码来源:userstoragesservice.php

示例11: 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;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:25,代码来源:configadapter.php

示例12: 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

示例13: readLegacyConfig

 /**
  * Read legacy config data
  *
  * @return array list of storage configs
  */
 protected function readLegacyConfig()
 {
     // read user config
     $user = $this->userSession->getUser()->getUID();
     return \OC_Mount_Config::readData($user);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:11,代码来源:UserLegacyStoragesService.php

示例14: readLegacyConfig

 /**
  * Read legacy config data
  *
  * @return array list of mount configs
  */
 protected function readLegacyConfig()
 {
     // read global config
     return \OC_Mount_Config::readData();
 }
开发者ID:fabricecetic,项目名称:core,代码行数:10,代码来源:globallegacystoragesservice.php

示例15: tearDown

 public function tearDown()
 {
     \OC_Mount_Config::$skipTest = false;
     self::$hookCalls = array();
     if ($this->dbConfig) {
         $this->dbConfig->clean();
     }
 }
开发者ID:fabricecetic,项目名称:core,代码行数:8,代码来源:storagesservicetest.php


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