@@ -34,9 +34,14 @@ public function buildObjectStore(array $config): IObjectStore {
3434 * @return ?ObjectStoreConfig
3535 */
3636 public function getObjectStoreConfigForRoot (): ?array {
37- $ config = $ this ->getObjectStoreConfig ();
37+ $ configs = $ this ->getObjectStoreConfig ();
38+ if (!$ configs ) {
39+ return null ;
40+ }
41+
42+ $ config = $ configs ['root ' ] ?? $ configs ['default ' ];
3843
39- if ($ config && $ config ['arguments ' ]['multibucket ' ]) {
44+ if ($ config ['arguments ' ]['multibucket ' ]) {
4045 if (!isset ($ config ['arguments ' ]['bucket ' ])) {
4146 $ config ['arguments ' ]['bucket ' ] = '' ;
4247 }
@@ -51,16 +56,27 @@ public function getObjectStoreConfigForRoot(): ?array {
5156 * @return ?ObjectStoreConfig
5257 */
5358 public function getObjectStoreConfigForUser (IUser $ user ): ?array {
54- $ config = $ this ->getObjectStoreConfig ();
59+ $ configs = $ this ->getObjectStoreConfig ();
60+ if (!$ configs ) {
61+ return null ;
62+ }
63+
64+ $ store = $ this ->config ->getUserValue ($ user ->getUID (), 'homeobjectstore ' , 'objectstore ' , null );
5565
56- if ($ config && $ config ['arguments ' ]['multibucket ' ]) {
66+ if ($ store ) {
67+ $ config = $ configs [$ store ];
68+ } else {
69+ $ config = $ configs ['default ' ];
70+ }
71+
72+ if ($ config ['arguments ' ]['multibucket ' ]) {
5773 $ config ['arguments ' ]['bucket ' ] = $ this ->getBucketForUser ($ user , $ config );
5874 }
5975 return $ config ;
6076 }
6177
6278 /**
63- * @return ?ObjectStoreConfig
79+ * @return ?array<string, ObjectStoreConfig>
6480 */
6581 private function getObjectStoreConfig (): ?array {
6682 $ objectStore = $ this ->config ->getSystemValue ('objectstore ' , null );
@@ -69,9 +85,17 @@ private function getObjectStoreConfig(): ?array {
6985 // new-style multibucket config uses the same 'objectstore' key but sets `'multibucket' => true`, transparently upgrade older style config
7086 if ($ objectStoreMultiBucket ) {
7187 $ objectStoreMultiBucket ['arguments ' ]['multibucket ' ] = true ;
72- return $ this ->validateObjectStoreConfig ($ objectStoreMultiBucket );
88+ return [
89+ 'default ' => $ this ->validateObjectStoreConfig ($ objectStoreMultiBucket )
90+ ];
7391 } elseif ($ objectStore ) {
74- return $ this ->validateObjectStoreConfig ($ objectStore );
92+ if (!isset ($ objectStore ['default ' ])) {
93+ $ objectStore = [
94+ 'default ' => $ objectStore ,
95+ ];
96+ }
97+
98+ return array_map ($ this ->validateObjectStoreConfig (...), $ objectStore );
7599 } else {
76100 return null ;
77101 }
0 commit comments