Пример #1
0
 private function serializeAuthBackend(\JsonSerializable $backend)
 {
     $data = $backend->jsonSerialize();
     $result = ['name' => $data['name'], 'identifier' => $data['identifier'], 'configuration' => array_map(function (DefinitionParameter $parameter) {
         return $parameter->getTypeName();
     }, $data['configuration'])];
     if ($backend instanceof Backend) {
         $result['storage_class'] = $backend->getStorageClass();
         $authBackends = $this->backendService->getAuthMechanismsByScheme(array_keys($backend->getAuthSchemes()));
         $result['supported_authentication_backends'] = array_keys($authBackends);
     }
     return $result;
 }
Пример #2
0
 private function serializeAuthBackend(\JsonSerializable $backend)
 {
     $data = $backend->jsonSerialize();
     $result = ['name' => $data['name'], 'identifier' => $data['identifier'], 'configuration' => $this->formatConfiguration($data['configuration'])];
     if ($backend instanceof Backend) {
         $result['storage_class'] = $backend->getStorageClass();
         $authBackends = $this->backendService->getAuthMechanismsByScheme(array_keys($backend->getAuthSchemes()));
         $result['supported_authentication_backends'] = array_keys($authBackends);
         $authConfig = array_map(function (AuthMechanism $auth) {
             return $this->serializeAuthBackend($auth)['configuration'];
         }, $authBackends);
         $result['authentication_configuration'] = array_combine(array_keys($authBackends), $authConfig);
     }
     return $result;
 }
Пример #3
0
 private function parseData(array $data)
 {
     $mount = new StorageConfig($data['mount_id']);
     $mount->setMountPoint($data['mount_point']);
     $mount->setBackend($this->getBackendByClass($data['storage']));
     $authBackends = $this->backendService->getAuthMechanismsByScheme([$data['authentication_type']]);
     $mount->setAuthMechanism(current($authBackends));
     $mount->setBackendOptions($data['configuration']);
     $mount->setMountOptions($data['options']);
     $mount->setApplicableUsers(isset($data['applicable_users']) ? $data['applicable_users'] : []);
     $mount->setApplicableGroups(isset($data['applicable_groups']) ? $data['applicable_groups'] : []);
     return $mount;
 }