@@ -33,39 +33,39 @@ |
||
33 | 33 | use Symfony\Component\Console\Output\OutputInterface; |
34 | 34 | |
35 | 35 | class CreateEmptyConfig extends Command { |
36 | - /** @var \OCA\User_LDAP\Helper */ |
|
37 | - protected $helper; |
|
36 | + /** @var \OCA\User_LDAP\Helper */ |
|
37 | + protected $helper; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param Helper $helper |
|
41 | - */ |
|
42 | - public function __construct(Helper $helper) { |
|
43 | - $this->helper = $helper; |
|
44 | - parent::__construct(); |
|
45 | - } |
|
39 | + /** |
|
40 | + * @param Helper $helper |
|
41 | + */ |
|
42 | + public function __construct(Helper $helper) { |
|
43 | + $this->helper = $helper; |
|
44 | + parent::__construct(); |
|
45 | + } |
|
46 | 46 | |
47 | - protected function configure() { |
|
48 | - $this |
|
49 | - ->setName('ldap:create-empty-config') |
|
50 | - ->setDescription('creates an empty LDAP configuration') |
|
51 | - ->addOption( |
|
52 | - 'only-print-prefix', |
|
53 | - 'p', |
|
54 | - InputOption::VALUE_NONE, |
|
55 | - 'outputs only the prefix' |
|
56 | - ) |
|
57 | - ; |
|
58 | - } |
|
47 | + protected function configure() { |
|
48 | + $this |
|
49 | + ->setName('ldap:create-empty-config') |
|
50 | + ->setDescription('creates an empty LDAP configuration') |
|
51 | + ->addOption( |
|
52 | + 'only-print-prefix', |
|
53 | + 'p', |
|
54 | + InputOption::VALUE_NONE, |
|
55 | + 'outputs only the prefix' |
|
56 | + ) |
|
57 | + ; |
|
58 | + } |
|
59 | 59 | |
60 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
61 | - $configPrefix = $this->helper->getNextServerConfigurationPrefix(); |
|
62 | - $configHolder = new Configuration($configPrefix); |
|
63 | - $configHolder->saveConfiguration(); |
|
60 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
61 | + $configPrefix = $this->helper->getNextServerConfigurationPrefix(); |
|
62 | + $configHolder = new Configuration($configPrefix); |
|
63 | + $configHolder->saveConfiguration(); |
|
64 | 64 | |
65 | - $prose = ''; |
|
66 | - if(!$input->getOption('only-print-prefix')) { |
|
67 | - $prose = 'Created new configuration with configID '; |
|
68 | - } |
|
69 | - $output->writeln($prose . "{$configPrefix}"); |
|
70 | - } |
|
65 | + $prose = ''; |
|
66 | + if(!$input->getOption('only-print-prefix')) { |
|
67 | + $prose = 'Created new configuration with configID '; |
|
68 | + } |
|
69 | + $output->writeln($prose . "{$configPrefix}"); |
|
70 | + } |
|
71 | 71 | } |
@@ -35,77 +35,77 @@ |
||
35 | 35 | use OCA\User_LDAP\Configuration; |
36 | 36 | |
37 | 37 | class ShowConfig extends Command { |
38 | - /** @var \OCA\User_LDAP\Helper */ |
|
39 | - protected $helper; |
|
38 | + /** @var \OCA\User_LDAP\Helper */ |
|
39 | + protected $helper; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param Helper $helper |
|
43 | - */ |
|
44 | - public function __construct(Helper $helper) { |
|
45 | - $this->helper = $helper; |
|
46 | - parent::__construct(); |
|
47 | - } |
|
41 | + /** |
|
42 | + * @param Helper $helper |
|
43 | + */ |
|
44 | + public function __construct(Helper $helper) { |
|
45 | + $this->helper = $helper; |
|
46 | + parent::__construct(); |
|
47 | + } |
|
48 | 48 | |
49 | - protected function configure() { |
|
50 | - $this |
|
51 | - ->setName('ldap:show-config') |
|
52 | - ->setDescription('shows the LDAP configuration') |
|
53 | - ->addArgument( |
|
54 | - 'configID', |
|
55 | - InputArgument::OPTIONAL, |
|
56 | - 'will show the configuration of the specified id' |
|
57 | - ) |
|
58 | - ->addOption( |
|
59 | - 'show-password', |
|
60 | - null, |
|
61 | - InputOption::VALUE_NONE, |
|
62 | - 'show ldap bind password' |
|
63 | - ) |
|
64 | - ; |
|
65 | - } |
|
49 | + protected function configure() { |
|
50 | + $this |
|
51 | + ->setName('ldap:show-config') |
|
52 | + ->setDescription('shows the LDAP configuration') |
|
53 | + ->addArgument( |
|
54 | + 'configID', |
|
55 | + InputArgument::OPTIONAL, |
|
56 | + 'will show the configuration of the specified id' |
|
57 | + ) |
|
58 | + ->addOption( |
|
59 | + 'show-password', |
|
60 | + null, |
|
61 | + InputOption::VALUE_NONE, |
|
62 | + 'show ldap bind password' |
|
63 | + ) |
|
64 | + ; |
|
65 | + } |
|
66 | 66 | |
67 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
68 | - $availableConfigs = $this->helper->getServerConfigurationPrefixes(); |
|
69 | - $configID = $input->getArgument('configID'); |
|
70 | - if(!is_null($configID)) { |
|
71 | - $configIDs[] = $configID; |
|
72 | - if(!in_array($configIDs[0], $availableConfigs)) { |
|
73 | - $output->writeln("Invalid configID"); |
|
74 | - return; |
|
75 | - } |
|
76 | - } else { |
|
77 | - $configIDs = $availableConfigs; |
|
78 | - } |
|
67 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
68 | + $availableConfigs = $this->helper->getServerConfigurationPrefixes(); |
|
69 | + $configID = $input->getArgument('configID'); |
|
70 | + if(!is_null($configID)) { |
|
71 | + $configIDs[] = $configID; |
|
72 | + if(!in_array($configIDs[0], $availableConfigs)) { |
|
73 | + $output->writeln("Invalid configID"); |
|
74 | + return; |
|
75 | + } |
|
76 | + } else { |
|
77 | + $configIDs = $availableConfigs; |
|
78 | + } |
|
79 | 79 | |
80 | - $this->renderConfigs($configIDs, $output, $input->getOption('show-password')); |
|
81 | - } |
|
80 | + $this->renderConfigs($configIDs, $output, $input->getOption('show-password')); |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * prints the LDAP configuration(s) |
|
85 | - * @param string[] configID(s) |
|
86 | - * @param OutputInterface $output |
|
87 | - * @param bool $withPassword Set to TRUE to show plaintext passwords in output |
|
88 | - */ |
|
89 | - protected function renderConfigs($configIDs, $output, $withPassword) { |
|
90 | - foreach($configIDs as $id) { |
|
91 | - $configHolder = new Configuration($id); |
|
92 | - $configuration = $configHolder->getConfiguration(); |
|
93 | - ksort($configuration); |
|
83 | + /** |
|
84 | + * prints the LDAP configuration(s) |
|
85 | + * @param string[] configID(s) |
|
86 | + * @param OutputInterface $output |
|
87 | + * @param bool $withPassword Set to TRUE to show plaintext passwords in output |
|
88 | + */ |
|
89 | + protected function renderConfigs($configIDs, $output, $withPassword) { |
|
90 | + foreach($configIDs as $id) { |
|
91 | + $configHolder = new Configuration($id); |
|
92 | + $configuration = $configHolder->getConfiguration(); |
|
93 | + ksort($configuration); |
|
94 | 94 | |
95 | - $table = new Table($output); |
|
96 | - $table->setHeaders(array('Configuration', $id)); |
|
97 | - $rows = array(); |
|
98 | - foreach($configuration as $key => $value) { |
|
99 | - if($key === 'ldapAgentPassword' && !$withPassword) { |
|
100 | - $value = '***'; |
|
101 | - } |
|
102 | - if(is_array($value)) { |
|
103 | - $value = implode(';', $value); |
|
104 | - } |
|
105 | - $rows[] = array($key, $value); |
|
106 | - } |
|
107 | - $table->setRows($rows); |
|
108 | - $table->render($output); |
|
109 | - } |
|
110 | - } |
|
95 | + $table = new Table($output); |
|
96 | + $table->setHeaders(array('Configuration', $id)); |
|
97 | + $rows = array(); |
|
98 | + foreach($configuration as $key => $value) { |
|
99 | + if($key === 'ldapAgentPassword' && !$withPassword) { |
|
100 | + $value = '***'; |
|
101 | + } |
|
102 | + if(is_array($value)) { |
|
103 | + $value = implode(';', $value); |
|
104 | + } |
|
105 | + $rows[] = array($key, $value); |
|
106 | + } |
|
107 | + $table->setRows($rows); |
|
108 | + $table->render($output); |
|
109 | + } |
|
110 | + } |
|
111 | 111 | } |
@@ -26,13 +26,13 @@ |
||
26 | 26 | namespace OCA\User_LDAP; |
27 | 27 | |
28 | 28 | abstract class LDAPUtility { |
29 | - protected $ldap; |
|
29 | + protected $ldap; |
|
30 | 30 | |
31 | - /** |
|
32 | - * constructor, make sure the subclasses call this one! |
|
33 | - * @param ILDAPWrapper $ldapWrapper an instance of an ILDAPWrapper |
|
34 | - */ |
|
35 | - public function __construct(ILDAPWrapper $ldapWrapper) { |
|
36 | - $this->ldap = $ldapWrapper; |
|
37 | - } |
|
31 | + /** |
|
32 | + * constructor, make sure the subclasses call this one! |
|
33 | + * @param ILDAPWrapper $ldapWrapper an instance of an ILDAPWrapper |
|
34 | + */ |
|
35 | + public function __construct(ILDAPWrapper $ldapWrapper) { |
|
36 | + $this->ldap = $ldapWrapper; |
|
37 | + } |
|
38 | 38 | } |
@@ -28,55 +28,55 @@ |
||
28 | 28 | use OCP\Settings\IIconSection; |
29 | 29 | |
30 | 30 | class Section implements IIconSection { |
31 | - /** @var IL10N */ |
|
32 | - private $l; |
|
33 | - /** @var IURLGenerator */ |
|
34 | - private $url; |
|
31 | + /** @var IL10N */ |
|
32 | + private $l; |
|
33 | + /** @var IURLGenerator */ |
|
34 | + private $url; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param IURLGenerator $url |
|
38 | - * @param IL10N $l |
|
39 | - */ |
|
40 | - public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | - $this->url = $url; |
|
42 | - $this->l = $l; |
|
43 | - } |
|
36 | + /** |
|
37 | + * @param IURLGenerator $url |
|
38 | + * @param IL10N $l |
|
39 | + */ |
|
40 | + public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | + $this->url = $url; |
|
42 | + $this->l = $l; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | - * e.g. 'ldap' |
|
48 | - * |
|
49 | - * @returns string |
|
50 | - */ |
|
51 | - public function getID() { |
|
52 | - return 'ldap'; |
|
53 | - } |
|
45 | + /** |
|
46 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | + * e.g. 'ldap' |
|
48 | + * |
|
49 | + * @returns string |
|
50 | + */ |
|
51 | + public function getID() { |
|
52 | + return 'ldap'; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | - * integration'. Use the L10N service to translate it. |
|
58 | - * |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function getName() { |
|
62 | - return $this->l->t('LDAP / AD integration'); |
|
63 | - } |
|
55 | + /** |
|
56 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | + * integration'. Use the L10N service to translate it. |
|
58 | + * |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function getName() { |
|
62 | + return $this->l->t('LDAP / AD integration'); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return int whether the form should be rather on the top or bottom of |
|
67 | - * the settings navigation. The sections are arranged in ascending order of |
|
68 | - * the priority values. It is required to return a value between 0 and 99. |
|
69 | - * |
|
70 | - * E.g.: 70 |
|
71 | - */ |
|
72 | - public function getPriority() { |
|
73 | - return 25; |
|
74 | - } |
|
65 | + /** |
|
66 | + * @return int whether the form should be rather on the top or bottom of |
|
67 | + * the settings navigation. The sections are arranged in ascending order of |
|
68 | + * the priority values. It is required to return a value between 0 and 99. |
|
69 | + * |
|
70 | + * E.g.: 70 |
|
71 | + */ |
|
72 | + public function getPriority() { |
|
73 | + return 25; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * {@inheritdoc} |
|
78 | - */ |
|
79 | - public function getIcon() { |
|
80 | - return $this->url->imagePath('user_ldap', 'app-dark.svg'); |
|
81 | - } |
|
76 | + /** |
|
77 | + * {@inheritdoc} |
|
78 | + */ |
|
79 | + public function getIcon() { |
|
80 | + return $this->url->imagePath('user_ldap', 'app-dark.svg'); |
|
81 | + } |
|
82 | 82 | } |
@@ -28,32 +28,32 @@ |
||
28 | 28 | use OCA\User_LDAP\Mapping\UserMapping; |
29 | 29 | |
30 | 30 | class LDAPProviderFactory implements ILDAPProviderFactory { |
31 | - /** |
|
32 | - * Server container |
|
33 | - * |
|
34 | - * @var IServerContainer |
|
35 | - */ |
|
36 | - private $serverContainer; |
|
31 | + /** |
|
32 | + * Server container |
|
33 | + * |
|
34 | + * @var IServerContainer |
|
35 | + */ |
|
36 | + private $serverContainer; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Constructor for the LDAP provider factory |
|
40 | - * |
|
41 | - * @param IServerContainer $serverContainer server container |
|
42 | - */ |
|
43 | - public function __construct(IServerContainer $serverContainer) { |
|
44 | - $this->serverContainer = $serverContainer; |
|
45 | - } |
|
38 | + /** |
|
39 | + * Constructor for the LDAP provider factory |
|
40 | + * |
|
41 | + * @param IServerContainer $serverContainer server container |
|
42 | + */ |
|
43 | + public function __construct(IServerContainer $serverContainer) { |
|
44 | + $this->serverContainer = $serverContainer; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * creates and returns an instance of the ILDAPProvider |
|
49 | - * |
|
50 | - * @return OCP\LDAP\ILDAPProvider |
|
51 | - */ |
|
52 | - public function getLDAPProvider() { |
|
53 | - $dbConnection = $this->serverContainer->getDatabaseConnection(); |
|
54 | - $userMapping = new UserMapping($dbConnection); |
|
55 | - return new LDAPProvider($this->serverContainer, new Helper($this->serverContainer->getConfig()), |
|
56 | - new DeletedUsersIndex($this->serverContainer->getConfig(), |
|
57 | - $dbConnection, $userMapping)); |
|
58 | - } |
|
47 | + /** |
|
48 | + * creates and returns an instance of the ILDAPProvider |
|
49 | + * |
|
50 | + * @return OCP\LDAP\ILDAPProvider |
|
51 | + */ |
|
52 | + public function getLDAPProvider() { |
|
53 | + $dbConnection = $this->serverContainer->getDatabaseConnection(); |
|
54 | + $userMapping = new UserMapping($dbConnection); |
|
55 | + return new LDAPProvider($this->serverContainer, new Helper($this->serverContainer->getConfig()), |
|
56 | + new DeletedUsersIndex($this->serverContainer->getConfig(), |
|
57 | + $dbConnection, $userMapping)); |
|
58 | + } |
|
59 | 59 | } |
@@ -24,25 +24,25 @@ |
||
24 | 24 | namespace OCA\Files_External\Service; |
25 | 25 | |
26 | 26 | class ImportLegacyStoragesService extends LegacyStoragesService { |
27 | - private $data; |
|
27 | + private $data; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @param BackendService $backendService |
|
31 | - */ |
|
32 | - public function __construct(BackendService $backendService) { |
|
33 | - $this->backendService = $backendService; |
|
34 | - } |
|
29 | + /** |
|
30 | + * @param BackendService $backendService |
|
31 | + */ |
|
32 | + public function __construct(BackendService $backendService) { |
|
33 | + $this->backendService = $backendService; |
|
34 | + } |
|
35 | 35 | |
36 | - public function setData($data) { |
|
37 | - $this->data = $data; |
|
38 | - } |
|
36 | + public function setData($data) { |
|
37 | + $this->data = $data; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Read legacy config data |
|
42 | - * |
|
43 | - * @return array list of mount configs |
|
44 | - */ |
|
45 | - protected function readLegacyConfig() { |
|
46 | - return $this->data; |
|
47 | - } |
|
40 | + /** |
|
41 | + * Read legacy config data |
|
42 | + * |
|
43 | + * @return array list of mount configs |
|
44 | + */ |
|
45 | + protected function readLegacyConfig() { |
|
46 | + return $this->data; |
|
47 | + } |
|
48 | 48 | } |
@@ -34,167 +34,167 @@ |
||
34 | 34 | */ |
35 | 35 | class UserGlobalStoragesService extends GlobalStoragesService { |
36 | 36 | |
37 | - use UserTrait; |
|
38 | - |
|
39 | - /** @var IGroupManager */ |
|
40 | - protected $groupManager; |
|
41 | - |
|
42 | - /** |
|
43 | - * @param BackendService $backendService |
|
44 | - * @param DBConfigService $dbConfig |
|
45 | - * @param IUserSession $userSession |
|
46 | - * @param IGroupManager $groupManager |
|
47 | - * @param IUserMountCache $userMountCache |
|
48 | - */ |
|
49 | - public function __construct( |
|
50 | - BackendService $backendService, |
|
51 | - DBConfigService $dbConfig, |
|
52 | - IUserSession $userSession, |
|
53 | - IGroupManager $groupManager, |
|
54 | - IUserMountCache $userMountCache |
|
55 | - ) { |
|
56 | - parent::__construct($backendService, $dbConfig, $userMountCache); |
|
57 | - $this->userSession = $userSession; |
|
58 | - $this->groupManager = $groupManager; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Replace config hash ID with real IDs, for migrating legacy storages |
|
63 | - * |
|
64 | - * @param StorageConfig[] $storages Storages with real IDs |
|
65 | - * @param StorageConfig[] $storagesWithConfigHash Storages with config hash IDs |
|
66 | - */ |
|
67 | - protected function setRealStorageIds(array &$storages, array $storagesWithConfigHash) { |
|
68 | - // as a read-only view, storage IDs don't need to be real |
|
69 | - foreach ($storagesWithConfigHash as $storage) { |
|
70 | - $storages[$storage->getId()] = $storage; |
|
71 | - } |
|
72 | - } |
|
73 | - |
|
74 | - protected function readDBConfig() { |
|
75 | - $userMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_USER, $this->getUser()->getUID()); |
|
76 | - $globalMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_GLOBAL, null); |
|
77 | - $groups = $this->groupManager->getUserGroupIds($this->getUser()); |
|
78 | - if (is_array($groups) && count($groups) !== 0) { |
|
79 | - $groupMounts = $this->dbConfig->getAdminMountsForMultiple(DBConfigService::APPLICABLE_TYPE_GROUP, $groups); |
|
80 | - } else { |
|
81 | - $groupMounts = []; |
|
82 | - } |
|
83 | - return array_merge($userMounts, $groupMounts, $globalMounts); |
|
84 | - } |
|
85 | - |
|
86 | - public function addStorage(StorageConfig $newStorage) { |
|
87 | - throw new \DomainException('UserGlobalStoragesService writing disallowed'); |
|
88 | - } |
|
89 | - |
|
90 | - public function updateStorage(StorageConfig $updatedStorage) { |
|
91 | - throw new \DomainException('UserGlobalStoragesService writing disallowed'); |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @param integer $id |
|
96 | - */ |
|
97 | - public function removeStorage($id) { |
|
98 | - throw new \DomainException('UserGlobalStoragesService writing disallowed'); |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Get unique storages, in case two are defined with the same mountpoint |
|
103 | - * Higher priority storages take precedence |
|
104 | - * |
|
105 | - * @return StorageConfig[] |
|
106 | - */ |
|
107 | - public function getUniqueStorages() { |
|
108 | - $storages = $this->getStorages(); |
|
109 | - |
|
110 | - $storagesByMountpoint = []; |
|
111 | - foreach ($storages as $storage) { |
|
112 | - $storagesByMountpoint[$storage->getMountPoint()][] = $storage; |
|
113 | - } |
|
114 | - |
|
115 | - $result = []; |
|
116 | - foreach ($storagesByMountpoint as $storageList) { |
|
117 | - $storage = array_reduce($storageList, function ($carry, $item) { |
|
118 | - if (isset($carry)) { |
|
119 | - $carryPriorityType = $this->getPriorityType($carry); |
|
120 | - $itemPriorityType = $this->getPriorityType($item); |
|
121 | - if ($carryPriorityType > $itemPriorityType) { |
|
122 | - return $carry; |
|
123 | - } elseif ($carryPriorityType === $itemPriorityType) { |
|
124 | - if ($carry->getPriority() > $item->getPriority()) { |
|
125 | - return $carry; |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - return $item; |
|
130 | - }); |
|
131 | - $result[$storage->getID()] = $storage; |
|
132 | - } |
|
133 | - |
|
134 | - return $result; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Get a priority 'type', where a bigger number means higher priority |
|
139 | - * user applicable > group applicable > 'all' |
|
140 | - * |
|
141 | - * @param StorageConfig $storage |
|
142 | - * @return int |
|
143 | - */ |
|
144 | - protected function getPriorityType(StorageConfig $storage) { |
|
145 | - $applicableUsers = $storage->getApplicableUsers(); |
|
146 | - $applicableGroups = $storage->getApplicableGroups(); |
|
147 | - |
|
148 | - if ($applicableUsers && $applicableUsers[0] !== 'all') { |
|
149 | - return 2; |
|
150 | - } |
|
151 | - if ($applicableGroups) { |
|
152 | - return 1; |
|
153 | - } |
|
154 | - return 0; |
|
155 | - } |
|
156 | - |
|
157 | - protected function isApplicable(StorageConfig $config) { |
|
158 | - $applicableUsers = $config->getApplicableUsers(); |
|
159 | - $applicableGroups = $config->getApplicableGroups(); |
|
160 | - |
|
161 | - if (count($applicableUsers) === 0 && count($applicableGroups) === 0) { |
|
162 | - return true; |
|
163 | - } |
|
164 | - if (in_array($this->getUser()->getUID(), $applicableUsers, true)) { |
|
165 | - return true; |
|
166 | - } |
|
167 | - $groupIds = $this->groupManager->getUserGroupIds($this->getUser()); |
|
168 | - foreach ($groupIds as $groupId) { |
|
169 | - if (in_array($groupId, $applicableGroups, true)) { |
|
170 | - return true; |
|
171 | - } |
|
172 | - } |
|
173 | - return false; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * Gets all storages for the user, admin, personal, global, etc |
|
179 | - * |
|
180 | - * @return StorageConfig[] array of storage configs |
|
181 | - */ |
|
182 | - public function getAllStoragesForUser() { |
|
183 | - if (is_null($this->getUser())) { |
|
184 | - return []; |
|
185 | - } |
|
186 | - $groupIds = $this->groupManager->getUserGroupIds($this->getUser()); |
|
187 | - $mounts = $this->dbConfig->getMountsForUser($this->getUser()->getUID(), $groupIds); |
|
188 | - $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts); |
|
189 | - $configs = array_filter($configs, function ($config) { |
|
190 | - return $config instanceof StorageConfig; |
|
191 | - }); |
|
192 | - |
|
193 | - $keys = array_map(function (StorageConfig $config) { |
|
194 | - return $config->getId(); |
|
195 | - }, $configs); |
|
196 | - |
|
197 | - $storages = array_combine($keys, $configs); |
|
198 | - return array_filter($storages, [$this, 'validateStorage']); |
|
199 | - } |
|
37 | + use UserTrait; |
|
38 | + |
|
39 | + /** @var IGroupManager */ |
|
40 | + protected $groupManager; |
|
41 | + |
|
42 | + /** |
|
43 | + * @param BackendService $backendService |
|
44 | + * @param DBConfigService $dbConfig |
|
45 | + * @param IUserSession $userSession |
|
46 | + * @param IGroupManager $groupManager |
|
47 | + * @param IUserMountCache $userMountCache |
|
48 | + */ |
|
49 | + public function __construct( |
|
50 | + BackendService $backendService, |
|
51 | + DBConfigService $dbConfig, |
|
52 | + IUserSession $userSession, |
|
53 | + IGroupManager $groupManager, |
|
54 | + IUserMountCache $userMountCache |
|
55 | + ) { |
|
56 | + parent::__construct($backendService, $dbConfig, $userMountCache); |
|
57 | + $this->userSession = $userSession; |
|
58 | + $this->groupManager = $groupManager; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Replace config hash ID with real IDs, for migrating legacy storages |
|
63 | + * |
|
64 | + * @param StorageConfig[] $storages Storages with real IDs |
|
65 | + * @param StorageConfig[] $storagesWithConfigHash Storages with config hash IDs |
|
66 | + */ |
|
67 | + protected function setRealStorageIds(array &$storages, array $storagesWithConfigHash) { |
|
68 | + // as a read-only view, storage IDs don't need to be real |
|
69 | + foreach ($storagesWithConfigHash as $storage) { |
|
70 | + $storages[$storage->getId()] = $storage; |
|
71 | + } |
|
72 | + } |
|
73 | + |
|
74 | + protected function readDBConfig() { |
|
75 | + $userMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_USER, $this->getUser()->getUID()); |
|
76 | + $globalMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_GLOBAL, null); |
|
77 | + $groups = $this->groupManager->getUserGroupIds($this->getUser()); |
|
78 | + if (is_array($groups) && count($groups) !== 0) { |
|
79 | + $groupMounts = $this->dbConfig->getAdminMountsForMultiple(DBConfigService::APPLICABLE_TYPE_GROUP, $groups); |
|
80 | + } else { |
|
81 | + $groupMounts = []; |
|
82 | + } |
|
83 | + return array_merge($userMounts, $groupMounts, $globalMounts); |
|
84 | + } |
|
85 | + |
|
86 | + public function addStorage(StorageConfig $newStorage) { |
|
87 | + throw new \DomainException('UserGlobalStoragesService writing disallowed'); |
|
88 | + } |
|
89 | + |
|
90 | + public function updateStorage(StorageConfig $updatedStorage) { |
|
91 | + throw new \DomainException('UserGlobalStoragesService writing disallowed'); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @param integer $id |
|
96 | + */ |
|
97 | + public function removeStorage($id) { |
|
98 | + throw new \DomainException('UserGlobalStoragesService writing disallowed'); |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Get unique storages, in case two are defined with the same mountpoint |
|
103 | + * Higher priority storages take precedence |
|
104 | + * |
|
105 | + * @return StorageConfig[] |
|
106 | + */ |
|
107 | + public function getUniqueStorages() { |
|
108 | + $storages = $this->getStorages(); |
|
109 | + |
|
110 | + $storagesByMountpoint = []; |
|
111 | + foreach ($storages as $storage) { |
|
112 | + $storagesByMountpoint[$storage->getMountPoint()][] = $storage; |
|
113 | + } |
|
114 | + |
|
115 | + $result = []; |
|
116 | + foreach ($storagesByMountpoint as $storageList) { |
|
117 | + $storage = array_reduce($storageList, function ($carry, $item) { |
|
118 | + if (isset($carry)) { |
|
119 | + $carryPriorityType = $this->getPriorityType($carry); |
|
120 | + $itemPriorityType = $this->getPriorityType($item); |
|
121 | + if ($carryPriorityType > $itemPriorityType) { |
|
122 | + return $carry; |
|
123 | + } elseif ($carryPriorityType === $itemPriorityType) { |
|
124 | + if ($carry->getPriority() > $item->getPriority()) { |
|
125 | + return $carry; |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + return $item; |
|
130 | + }); |
|
131 | + $result[$storage->getID()] = $storage; |
|
132 | + } |
|
133 | + |
|
134 | + return $result; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Get a priority 'type', where a bigger number means higher priority |
|
139 | + * user applicable > group applicable > 'all' |
|
140 | + * |
|
141 | + * @param StorageConfig $storage |
|
142 | + * @return int |
|
143 | + */ |
|
144 | + protected function getPriorityType(StorageConfig $storage) { |
|
145 | + $applicableUsers = $storage->getApplicableUsers(); |
|
146 | + $applicableGroups = $storage->getApplicableGroups(); |
|
147 | + |
|
148 | + if ($applicableUsers && $applicableUsers[0] !== 'all') { |
|
149 | + return 2; |
|
150 | + } |
|
151 | + if ($applicableGroups) { |
|
152 | + return 1; |
|
153 | + } |
|
154 | + return 0; |
|
155 | + } |
|
156 | + |
|
157 | + protected function isApplicable(StorageConfig $config) { |
|
158 | + $applicableUsers = $config->getApplicableUsers(); |
|
159 | + $applicableGroups = $config->getApplicableGroups(); |
|
160 | + |
|
161 | + if (count($applicableUsers) === 0 && count($applicableGroups) === 0) { |
|
162 | + return true; |
|
163 | + } |
|
164 | + if (in_array($this->getUser()->getUID(), $applicableUsers, true)) { |
|
165 | + return true; |
|
166 | + } |
|
167 | + $groupIds = $this->groupManager->getUserGroupIds($this->getUser()); |
|
168 | + foreach ($groupIds as $groupId) { |
|
169 | + if (in_array($groupId, $applicableGroups, true)) { |
|
170 | + return true; |
|
171 | + } |
|
172 | + } |
|
173 | + return false; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * Gets all storages for the user, admin, personal, global, etc |
|
179 | + * |
|
180 | + * @return StorageConfig[] array of storage configs |
|
181 | + */ |
|
182 | + public function getAllStoragesForUser() { |
|
183 | + if (is_null($this->getUser())) { |
|
184 | + return []; |
|
185 | + } |
|
186 | + $groupIds = $this->groupManager->getUserGroupIds($this->getUser()); |
|
187 | + $mounts = $this->dbConfig->getMountsForUser($this->getUser()->getUID(), $groupIds); |
|
188 | + $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts); |
|
189 | + $configs = array_filter($configs, function ($config) { |
|
190 | + return $config instanceof StorageConfig; |
|
191 | + }); |
|
192 | + |
|
193 | + $keys = array_map(function (StorageConfig $config) { |
|
194 | + return $config->getId(); |
|
195 | + }, $configs); |
|
196 | + |
|
197 | + $storages = array_combine($keys, $configs); |
|
198 | + return array_filter($storages, [$this, 'validateStorage']); |
|
199 | + } |
|
200 | 200 | } |
@@ -35,151 +35,151 @@ |
||
35 | 35 | * Service class to manage global external storages |
36 | 36 | */ |
37 | 37 | class GlobalStoragesService extends StoragesService { |
38 | - /** |
|
39 | - * Triggers $signal for all applicable users of the given |
|
40 | - * storage |
|
41 | - * |
|
42 | - * @param StorageConfig $storage storage data |
|
43 | - * @param string $signal signal to trigger |
|
44 | - */ |
|
45 | - protected function triggerHooks(StorageConfig $storage, $signal) { |
|
46 | - // FIXME: Use as expression in empty once PHP 5.4 support is dropped |
|
47 | - $applicableUsers = $storage->getApplicableUsers(); |
|
48 | - $applicableGroups = $storage->getApplicableGroups(); |
|
49 | - if (empty($applicableUsers) && empty($applicableGroups)) { |
|
50 | - // raise for user "all" |
|
51 | - $this->triggerApplicableHooks( |
|
52 | - $signal, |
|
53 | - $storage->getMountPoint(), |
|
54 | - \OC_Mount_Config::MOUNT_TYPE_USER, |
|
55 | - ['all'] |
|
56 | - ); |
|
57 | - return; |
|
58 | - } |
|
59 | - |
|
60 | - $this->triggerApplicableHooks( |
|
61 | - $signal, |
|
62 | - $storage->getMountPoint(), |
|
63 | - \OC_Mount_Config::MOUNT_TYPE_USER, |
|
64 | - $applicableUsers |
|
65 | - ); |
|
66 | - $this->triggerApplicableHooks( |
|
67 | - $signal, |
|
68 | - $storage->getMountPoint(), |
|
69 | - \OC_Mount_Config::MOUNT_TYPE_GROUP, |
|
70 | - $applicableGroups |
|
71 | - ); |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * Triggers signal_create_mount or signal_delete_mount to |
|
76 | - * accommodate for additions/deletions in applicableUsers |
|
77 | - * and applicableGroups fields. |
|
78 | - * |
|
79 | - * @param StorageConfig $oldStorage old storage config |
|
80 | - * @param StorageConfig $newStorage new storage config |
|
81 | - */ |
|
82 | - protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $newStorage) { |
|
83 | - // if mount point changed, it's like a deletion + creation |
|
84 | - if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) { |
|
85 | - $this->triggerHooks($oldStorage, Filesystem::signal_delete_mount); |
|
86 | - $this->triggerHooks($newStorage, Filesystem::signal_create_mount); |
|
87 | - return; |
|
88 | - } |
|
89 | - |
|
90 | - $userAdditions = array_diff($newStorage->getApplicableUsers(), $oldStorage->getApplicableUsers()); |
|
91 | - $userDeletions = array_diff($oldStorage->getApplicableUsers(), $newStorage->getApplicableUsers()); |
|
92 | - $groupAdditions = array_diff($newStorage->getApplicableGroups(), $oldStorage->getApplicableGroups()); |
|
93 | - $groupDeletions = array_diff($oldStorage->getApplicableGroups(), $newStorage->getApplicableGroups()); |
|
94 | - |
|
95 | - // FIXME: Use as expression in empty once PHP 5.4 support is dropped |
|
96 | - // if no applicable were set, raise a signal for "all" |
|
97 | - $oldApplicableUsers = $oldStorage->getApplicableUsers(); |
|
98 | - $oldApplicableGroups = $oldStorage->getApplicableGroups(); |
|
99 | - if (empty($oldApplicableUsers) && empty($oldApplicableGroups)) { |
|
100 | - $this->triggerApplicableHooks( |
|
101 | - Filesystem::signal_delete_mount, |
|
102 | - $oldStorage->getMountPoint(), |
|
103 | - \OC_Mount_Config::MOUNT_TYPE_USER, |
|
104 | - ['all'] |
|
105 | - ); |
|
106 | - } |
|
107 | - |
|
108 | - // trigger delete for removed users |
|
109 | - $this->triggerApplicableHooks( |
|
110 | - Filesystem::signal_delete_mount, |
|
111 | - $oldStorage->getMountPoint(), |
|
112 | - \OC_Mount_Config::MOUNT_TYPE_USER, |
|
113 | - $userDeletions |
|
114 | - ); |
|
115 | - |
|
116 | - // trigger delete for removed groups |
|
117 | - $this->triggerApplicableHooks( |
|
118 | - Filesystem::signal_delete_mount, |
|
119 | - $oldStorage->getMountPoint(), |
|
120 | - \OC_Mount_Config::MOUNT_TYPE_GROUP, |
|
121 | - $groupDeletions |
|
122 | - ); |
|
123 | - |
|
124 | - // and now add the new users |
|
125 | - $this->triggerApplicableHooks( |
|
126 | - Filesystem::signal_create_mount, |
|
127 | - $newStorage->getMountPoint(), |
|
128 | - \OC_Mount_Config::MOUNT_TYPE_USER, |
|
129 | - $userAdditions |
|
130 | - ); |
|
131 | - |
|
132 | - // and now add the new groups |
|
133 | - $this->triggerApplicableHooks( |
|
134 | - Filesystem::signal_create_mount, |
|
135 | - $newStorage->getMountPoint(), |
|
136 | - \OC_Mount_Config::MOUNT_TYPE_GROUP, |
|
137 | - $groupAdditions |
|
138 | - ); |
|
139 | - |
|
140 | - // FIXME: Use as expression in empty once PHP 5.4 support is dropped |
|
141 | - // if no applicable, raise a signal for "all" |
|
142 | - $newApplicableUsers = $newStorage->getApplicableUsers(); |
|
143 | - $newApplicableGroups = $newStorage->getApplicableGroups(); |
|
144 | - if (empty($newApplicableUsers) && empty($newApplicableGroups)) { |
|
145 | - $this->triggerApplicableHooks( |
|
146 | - Filesystem::signal_create_mount, |
|
147 | - $newStorage->getMountPoint(), |
|
148 | - \OC_Mount_Config::MOUNT_TYPE_USER, |
|
149 | - ['all'] |
|
150 | - ); |
|
151 | - } |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Get the visibility type for this controller, used in validation |
|
156 | - * |
|
157 | - * @return string BackendService::VISIBILITY_* constants |
|
158 | - */ |
|
159 | - public function getVisibilityType() { |
|
160 | - return BackendService::VISIBILITY_ADMIN; |
|
161 | - } |
|
162 | - |
|
163 | - protected function isApplicable(StorageConfig $config) { |
|
164 | - return true; |
|
165 | - } |
|
166 | - |
|
167 | - /** |
|
168 | - * Get all configured admin and personal mounts |
|
169 | - * |
|
170 | - * @return array map of storage id to storage config |
|
171 | - */ |
|
172 | - public function getStorageForAllUsers() { |
|
173 | - $mounts = $this->dbConfig->getAllMounts(); |
|
174 | - $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts); |
|
175 | - $configs = array_filter($configs, function ($config) { |
|
176 | - return $config instanceof StorageConfig; |
|
177 | - }); |
|
178 | - |
|
179 | - $keys = array_map(function (StorageConfig $config) { |
|
180 | - return $config->getId(); |
|
181 | - }, $configs); |
|
182 | - |
|
183 | - return array_combine($keys, $configs); |
|
184 | - } |
|
38 | + /** |
|
39 | + * Triggers $signal for all applicable users of the given |
|
40 | + * storage |
|
41 | + * |
|
42 | + * @param StorageConfig $storage storage data |
|
43 | + * @param string $signal signal to trigger |
|
44 | + */ |
|
45 | + protected function triggerHooks(StorageConfig $storage, $signal) { |
|
46 | + // FIXME: Use as expression in empty once PHP 5.4 support is dropped |
|
47 | + $applicableUsers = $storage->getApplicableUsers(); |
|
48 | + $applicableGroups = $storage->getApplicableGroups(); |
|
49 | + if (empty($applicableUsers) && empty($applicableGroups)) { |
|
50 | + // raise for user "all" |
|
51 | + $this->triggerApplicableHooks( |
|
52 | + $signal, |
|
53 | + $storage->getMountPoint(), |
|
54 | + \OC_Mount_Config::MOUNT_TYPE_USER, |
|
55 | + ['all'] |
|
56 | + ); |
|
57 | + return; |
|
58 | + } |
|
59 | + |
|
60 | + $this->triggerApplicableHooks( |
|
61 | + $signal, |
|
62 | + $storage->getMountPoint(), |
|
63 | + \OC_Mount_Config::MOUNT_TYPE_USER, |
|
64 | + $applicableUsers |
|
65 | + ); |
|
66 | + $this->triggerApplicableHooks( |
|
67 | + $signal, |
|
68 | + $storage->getMountPoint(), |
|
69 | + \OC_Mount_Config::MOUNT_TYPE_GROUP, |
|
70 | + $applicableGroups |
|
71 | + ); |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * Triggers signal_create_mount or signal_delete_mount to |
|
76 | + * accommodate for additions/deletions in applicableUsers |
|
77 | + * and applicableGroups fields. |
|
78 | + * |
|
79 | + * @param StorageConfig $oldStorage old storage config |
|
80 | + * @param StorageConfig $newStorage new storage config |
|
81 | + */ |
|
82 | + protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $newStorage) { |
|
83 | + // if mount point changed, it's like a deletion + creation |
|
84 | + if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) { |
|
85 | + $this->triggerHooks($oldStorage, Filesystem::signal_delete_mount); |
|
86 | + $this->triggerHooks($newStorage, Filesystem::signal_create_mount); |
|
87 | + return; |
|
88 | + } |
|
89 | + |
|
90 | + $userAdditions = array_diff($newStorage->getApplicableUsers(), $oldStorage->getApplicableUsers()); |
|
91 | + $userDeletions = array_diff($oldStorage->getApplicableUsers(), $newStorage->getApplicableUsers()); |
|
92 | + $groupAdditions = array_diff($newStorage->getApplicableGroups(), $oldStorage->getApplicableGroups()); |
|
93 | + $groupDeletions = array_diff($oldStorage->getApplicableGroups(), $newStorage->getApplicableGroups()); |
|
94 | + |
|
95 | + // FIXME: Use as expression in empty once PHP 5.4 support is dropped |
|
96 | + // if no applicable were set, raise a signal for "all" |
|
97 | + $oldApplicableUsers = $oldStorage->getApplicableUsers(); |
|
98 | + $oldApplicableGroups = $oldStorage->getApplicableGroups(); |
|
99 | + if (empty($oldApplicableUsers) && empty($oldApplicableGroups)) { |
|
100 | + $this->triggerApplicableHooks( |
|
101 | + Filesystem::signal_delete_mount, |
|
102 | + $oldStorage->getMountPoint(), |
|
103 | + \OC_Mount_Config::MOUNT_TYPE_USER, |
|
104 | + ['all'] |
|
105 | + ); |
|
106 | + } |
|
107 | + |
|
108 | + // trigger delete for removed users |
|
109 | + $this->triggerApplicableHooks( |
|
110 | + Filesystem::signal_delete_mount, |
|
111 | + $oldStorage->getMountPoint(), |
|
112 | + \OC_Mount_Config::MOUNT_TYPE_USER, |
|
113 | + $userDeletions |
|
114 | + ); |
|
115 | + |
|
116 | + // trigger delete for removed groups |
|
117 | + $this->triggerApplicableHooks( |
|
118 | + Filesystem::signal_delete_mount, |
|
119 | + $oldStorage->getMountPoint(), |
|
120 | + \OC_Mount_Config::MOUNT_TYPE_GROUP, |
|
121 | + $groupDeletions |
|
122 | + ); |
|
123 | + |
|
124 | + // and now add the new users |
|
125 | + $this->triggerApplicableHooks( |
|
126 | + Filesystem::signal_create_mount, |
|
127 | + $newStorage->getMountPoint(), |
|
128 | + \OC_Mount_Config::MOUNT_TYPE_USER, |
|
129 | + $userAdditions |
|
130 | + ); |
|
131 | + |
|
132 | + // and now add the new groups |
|
133 | + $this->triggerApplicableHooks( |
|
134 | + Filesystem::signal_create_mount, |
|
135 | + $newStorage->getMountPoint(), |
|
136 | + \OC_Mount_Config::MOUNT_TYPE_GROUP, |
|
137 | + $groupAdditions |
|
138 | + ); |
|
139 | + |
|
140 | + // FIXME: Use as expression in empty once PHP 5.4 support is dropped |
|
141 | + // if no applicable, raise a signal for "all" |
|
142 | + $newApplicableUsers = $newStorage->getApplicableUsers(); |
|
143 | + $newApplicableGroups = $newStorage->getApplicableGroups(); |
|
144 | + if (empty($newApplicableUsers) && empty($newApplicableGroups)) { |
|
145 | + $this->triggerApplicableHooks( |
|
146 | + Filesystem::signal_create_mount, |
|
147 | + $newStorage->getMountPoint(), |
|
148 | + \OC_Mount_Config::MOUNT_TYPE_USER, |
|
149 | + ['all'] |
|
150 | + ); |
|
151 | + } |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Get the visibility type for this controller, used in validation |
|
156 | + * |
|
157 | + * @return string BackendService::VISIBILITY_* constants |
|
158 | + */ |
|
159 | + public function getVisibilityType() { |
|
160 | + return BackendService::VISIBILITY_ADMIN; |
|
161 | + } |
|
162 | + |
|
163 | + protected function isApplicable(StorageConfig $config) { |
|
164 | + return true; |
|
165 | + } |
|
166 | + |
|
167 | + /** |
|
168 | + * Get all configured admin and personal mounts |
|
169 | + * |
|
170 | + * @return array map of storage id to storage config |
|
171 | + */ |
|
172 | + public function getStorageForAllUsers() { |
|
173 | + $mounts = $this->dbConfig->getAllMounts(); |
|
174 | + $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts); |
|
175 | + $configs = array_filter($configs, function ($config) { |
|
176 | + return $config instanceof StorageConfig; |
|
177 | + }); |
|
178 | + |
|
179 | + $keys = array_map(function (StorageConfig $config) { |
|
180 | + return $config->getId(); |
|
181 | + }, $configs); |
|
182 | + |
|
183 | + return array_combine($keys, $configs); |
|
184 | + } |
|
185 | 185 | } |
@@ -29,28 +29,28 @@ |
||
29 | 29 | * Read user defined mounts from the legacy mount.json |
30 | 30 | */ |
31 | 31 | class UserLegacyStoragesService extends LegacyStoragesService { |
32 | - /** |
|
33 | - * @var IUserSession |
|
34 | - */ |
|
35 | - private $userSession; |
|
32 | + /** |
|
33 | + * @var IUserSession |
|
34 | + */ |
|
35 | + private $userSession; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param BackendService $backendService |
|
39 | - * @param IUserSession $userSession |
|
40 | - */ |
|
41 | - public function __construct(BackendService $backendService, IUserSession $userSession) { |
|
42 | - $this->backendService = $backendService; |
|
43 | - $this->userSession = $userSession; |
|
44 | - } |
|
37 | + /** |
|
38 | + * @param BackendService $backendService |
|
39 | + * @param IUserSession $userSession |
|
40 | + */ |
|
41 | + public function __construct(BackendService $backendService, IUserSession $userSession) { |
|
42 | + $this->backendService = $backendService; |
|
43 | + $this->userSession = $userSession; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Read legacy config data |
|
48 | - * |
|
49 | - * @return array list of storage configs |
|
50 | - */ |
|
51 | - protected function readLegacyConfig() { |
|
52 | - // read user config |
|
53 | - $user = $this->userSession->getUser()->getUID(); |
|
54 | - return \OC_Mount_Config::readData($user); |
|
55 | - } |
|
46 | + /** |
|
47 | + * Read legacy config data |
|
48 | + * |
|
49 | + * @return array list of storage configs |
|
50 | + */ |
|
51 | + protected function readLegacyConfig() { |
|
52 | + // read user config |
|
53 | + $user = $this->userSession->getUser()->getUID(); |
|
54 | + return \OC_Mount_Config::readData($user); |
|
55 | + } |
|
56 | 56 | } |