コード例 #1
0
ファイル: backendtest.php プロジェクト: loulancn/core
 public function testLegacyAuthMechanismCallback()
 {
     $backend = new Backend();
     $backend->setLegacyAuthMechanismCallback(function (array $params) {
         if (isset($params['ping'])) {
             return 'pong';
         }
         return 'foobar';
     });
     $this->assertEquals('pong', $backend->getLegacyAuthMechanism(['ping' => true]));
     $this->assertEquals('foobar', $backend->getLegacyAuthMechanism(['other' => true]));
     $this->assertEquals('foobar', $backend->getLegacyAuthMechanism());
 }
コード例 #2
0
ファイル: storageconfig.php プロジェクト: evanjt/core
 /**
  * Serialize config to JSON
  *
  * @return array
  */
 public function jsonSerialize()
 {
     $result = [];
     if (!is_null($this->id)) {
         $result['id'] = $this->id;
     }
     $result['mountPoint'] = $this->mountPoint;
     $result['backend'] = $this->backend->getIdentifier();
     $result['authMechanism'] = $this->authMechanism->getIdentifier();
     $result['backendOptions'] = $this->backendOptions;
     if (!is_null($this->priority)) {
         $result['priority'] = $this->priority;
     }
     if (!empty($this->applicableUsers)) {
         $result['applicableUsers'] = $this->applicableUsers;
     }
     if (!empty($this->applicableGroups)) {
         $result['applicableGroups'] = $this->applicableGroups;
     }
     if (!empty($this->mountOptions)) {
         $result['mountOptions'] = $this->mountOptions;
     }
     if (!is_null($this->status)) {
         $result['status'] = $this->status;
     }
     if (!is_null($this->statusMessage)) {
         $result['statusMessage'] = $this->statusMessage;
     }
     return $result;
 }
コード例 #3
0
 /**
  * Serialize config to JSON
  *
  * @return array
  */
 public function jsonSerialize()
 {
     $result = [];
     if (!is_null($this->id)) {
         $result['id'] = $this->id;
     }
     $result['mountPoint'] = $this->mountPoint;
     $result['backend'] = $this->backend->getIdentifier();
     $result['authMechanism'] = $this->authMechanism->getIdentifier();
     $result['backendOptions'] = $this->backendOptions;
     if (!is_null($this->priority)) {
         $result['priority'] = $this->priority;
     }
     if (!empty($this->applicableUsers)) {
         $result['applicableUsers'] = $this->applicableUsers;
     }
     if (!empty($this->applicableGroups)) {
         $result['applicableGroups'] = $this->applicableGroups;
     }
     if (!empty($this->mountOptions)) {
         $result['mountOptions'] = $this->mountOptions;
     }
     if (!is_null($this->status)) {
         $result['status'] = $this->status;
     }
     if (!is_null($this->statusMessage)) {
         $result['statusMessage'] = $this->statusMessage;
     }
     $result['userProvided'] = $this->authMechanism instanceof IUserProvided;
     $result['type'] = $this->getType() === self::MOUNT_TYPE_PERSONAl ? 'personal' : 'system';
     return $result;
 }
コード例 #4
0
ファイル: backendservice.php プロジェクト: 0x17de/core
 /**
  * Check a backend if a user is allowed to mount it
  *
  * @param Backend $backend
  * @return bool
  */
 protected function isAllowedUserBackend(Backend $backend)
 {
     if ($this->userMountingAllowed && array_intersect($backend->getIdentifierAliases(), $this->userMountingBackends)) {
         return true;
     }
     return false;
 }
コード例 #5
0
ファイル: Create.php プロジェクト: rchicoli/owncloud-core
 private function validateParam($key, &$value, Backend $storageBackend, AuthMechanism $authBackend)
 {
     $params = array_merge($storageBackend->getParameters(), $authBackend->getParameters());
     foreach ($params as $param) {
         /** @var DefinitionParameter $param */
         if ($param->getName() === $key) {
             if ($param->getType() === DefinitionParameter::VALUE_BOOLEAN) {
                 $value = $value === 'true';
             }
             return true;
         }
     }
     return false;
 }