@@ -24,44 +24,44 @@ |
||
24 | 24 | use OCP\Files\Search\ISearchComparison; |
25 | 25 | |
26 | 26 | class SearchComparison implements ISearchComparison { |
27 | - /** @var string */ |
|
28 | - private $type; |
|
29 | - /** @var string */ |
|
30 | - private $field; |
|
31 | - /** @var string|integer|\DateTime */ |
|
32 | - private $value; |
|
27 | + /** @var string */ |
|
28 | + private $type; |
|
29 | + /** @var string */ |
|
30 | + private $field; |
|
31 | + /** @var string|integer|\DateTime */ |
|
32 | + private $value; |
|
33 | 33 | |
34 | - /** |
|
35 | - * SearchComparison constructor. |
|
36 | - * |
|
37 | - * @param string $type |
|
38 | - * @param string $field |
|
39 | - * @param \DateTime|int|string $value |
|
40 | - */ |
|
41 | - public function __construct($type, $field, $value) { |
|
42 | - $this->type = $type; |
|
43 | - $this->field = $field; |
|
44 | - $this->value = $value; |
|
45 | - } |
|
34 | + /** |
|
35 | + * SearchComparison constructor. |
|
36 | + * |
|
37 | + * @param string $type |
|
38 | + * @param string $field |
|
39 | + * @param \DateTime|int|string $value |
|
40 | + */ |
|
41 | + public function __construct($type, $field, $value) { |
|
42 | + $this->type = $type; |
|
43 | + $this->field = $field; |
|
44 | + $this->value = $value; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return string |
|
49 | - */ |
|
50 | - public function getType() { |
|
51 | - return $this->type; |
|
52 | - } |
|
47 | + /** |
|
48 | + * @return string |
|
49 | + */ |
|
50 | + public function getType() { |
|
51 | + return $this->type; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public function getField() { |
|
58 | - return $this->field; |
|
59 | - } |
|
54 | + /** |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public function getField() { |
|
58 | + return $this->field; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return \DateTime|int|string |
|
63 | - */ |
|
64 | - public function getValue() { |
|
65 | - return $this->value; |
|
66 | - } |
|
61 | + /** |
|
62 | + * @return \DateTime|int|string |
|
63 | + */ |
|
64 | + public function getValue() { |
|
65 | + return $this->value; |
|
66 | + } |
|
67 | 67 | } |
@@ -25,33 +25,33 @@ |
||
25 | 25 | use OCP\Files\Search\ISearchOrder; |
26 | 26 | |
27 | 27 | class SearchOrder implements ISearchOrder { |
28 | - /** @var string */ |
|
29 | - private $direction; |
|
30 | - /** @var string */ |
|
31 | - private $field; |
|
28 | + /** @var string */ |
|
29 | + private $direction; |
|
30 | + /** @var string */ |
|
31 | + private $field; |
|
32 | 32 | |
33 | - /** |
|
34 | - * SearchOrder constructor. |
|
35 | - * |
|
36 | - * @param string $direction |
|
37 | - * @param string $field |
|
38 | - */ |
|
39 | - public function __construct($direction, $field) { |
|
40 | - $this->direction = $direction; |
|
41 | - $this->field = $field; |
|
42 | - } |
|
33 | + /** |
|
34 | + * SearchOrder constructor. |
|
35 | + * |
|
36 | + * @param string $direction |
|
37 | + * @param string $field |
|
38 | + */ |
|
39 | + public function __construct($direction, $field) { |
|
40 | + $this->direction = $direction; |
|
41 | + $this->field = $field; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @return string |
|
46 | - */ |
|
47 | - public function getDirection() { |
|
48 | - return $this->direction; |
|
49 | - } |
|
44 | + /** |
|
45 | + * @return string |
|
46 | + */ |
|
47 | + public function getDirection() { |
|
48 | + return $this->direction; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return string |
|
53 | - */ |
|
54 | - public function getField() { |
|
55 | - return $this->field; |
|
56 | - } |
|
51 | + /** |
|
52 | + * @return string |
|
53 | + */ |
|
54 | + public function getField() { |
|
55 | + return $this->field; |
|
56 | + } |
|
57 | 57 | } |
@@ -25,33 +25,33 @@ |
||
25 | 25 | use OCP\Files\Search\ISearchOperator; |
26 | 26 | |
27 | 27 | class SearchBinaryOperator implements ISearchBinaryOperator { |
28 | - /** @var string */ |
|
29 | - private $type; |
|
30 | - /** @var ISearchOperator[] */ |
|
31 | - private $arguments; |
|
28 | + /** @var string */ |
|
29 | + private $type; |
|
30 | + /** @var ISearchOperator[] */ |
|
31 | + private $arguments; |
|
32 | 32 | |
33 | - /** |
|
34 | - * SearchBinaryOperator constructor. |
|
35 | - * |
|
36 | - * @param string $type |
|
37 | - * @param ISearchOperator[] $arguments |
|
38 | - */ |
|
39 | - public function __construct($type, array $arguments) { |
|
40 | - $this->type = $type; |
|
41 | - $this->arguments = $arguments; |
|
42 | - } |
|
33 | + /** |
|
34 | + * SearchBinaryOperator constructor. |
|
35 | + * |
|
36 | + * @param string $type |
|
37 | + * @param ISearchOperator[] $arguments |
|
38 | + */ |
|
39 | + public function __construct($type, array $arguments) { |
|
40 | + $this->type = $type; |
|
41 | + $this->arguments = $arguments; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @return string |
|
46 | - */ |
|
47 | - public function getType() { |
|
48 | - return $this->type; |
|
49 | - } |
|
44 | + /** |
|
45 | + * @return string |
|
46 | + */ |
|
47 | + public function getType() { |
|
48 | + return $this->type; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return ISearchOperator[] |
|
53 | - */ |
|
54 | - public function getArguments() { |
|
55 | - return $this->arguments; |
|
56 | - } |
|
51 | + /** |
|
52 | + * @return ISearchOperator[] |
|
53 | + */ |
|
54 | + public function getArguments() { |
|
55 | + return $this->arguments; |
|
56 | + } |
|
57 | 57 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $updatedEntries = $builder->execute(); |
73 | 73 | if ($updatedEntries > 0) { |
74 | - $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares'); |
|
74 | + $out->info('Fixed file share permissions for '.$updatedEntries.' shares'); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | if ($deletedEntries) { |
110 | - $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist'); |
|
110 | + $out->info('Removed '.$deletedEntries.' shares where the parent did not exist'); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 |
@@ -33,90 +33,90 @@ |
||
33 | 33 | */ |
34 | 34 | class RepairInvalidShares implements IRepairStep { |
35 | 35 | |
36 | - const CHUNK_SIZE = 200; |
|
37 | - |
|
38 | - /** @var \OCP\IConfig */ |
|
39 | - protected $config; |
|
40 | - |
|
41 | - /** @var \OCP\IDBConnection */ |
|
42 | - protected $connection; |
|
43 | - |
|
44 | - /** |
|
45 | - * @param \OCP\IConfig $config |
|
46 | - * @param \OCP\IDBConnection $connection |
|
47 | - */ |
|
48 | - public function __construct($config, $connection) { |
|
49 | - $this->connection = $connection; |
|
50 | - $this->config = $config; |
|
51 | - } |
|
52 | - |
|
53 | - public function getName() { |
|
54 | - return 'Repair invalid shares'; |
|
55 | - } |
|
56 | - |
|
57 | - /** |
|
58 | - * Adjust file share permissions |
|
59 | - * @suppress SqlInjectionChecker |
|
60 | - */ |
|
61 | - private function adjustFileSharePermissions(IOutput $out) { |
|
62 | - $mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE; |
|
63 | - $builder = $this->connection->getQueryBuilder(); |
|
64 | - |
|
65 | - $permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask); |
|
66 | - $builder |
|
67 | - ->update('share') |
|
68 | - ->set('permissions', $permsFunc) |
|
69 | - ->where($builder->expr()->eq('item_type', $builder->expr()->literal('file'))) |
|
70 | - ->andWhere($builder->expr()->neq('permissions', $permsFunc)); |
|
71 | - |
|
72 | - $updatedEntries = $builder->execute(); |
|
73 | - if ($updatedEntries > 0) { |
|
74 | - $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares'); |
|
75 | - } |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Remove shares where the parent share does not exist anymore |
|
80 | - */ |
|
81 | - private function removeSharesNonExistingParent(IOutput $out) { |
|
82 | - $deletedEntries = 0; |
|
83 | - |
|
84 | - $query = $this->connection->getQueryBuilder(); |
|
85 | - $query->select('s1.parent') |
|
86 | - ->from('share', 's1') |
|
87 | - ->where($query->expr()->isNotNull('s1.parent')) |
|
88 | - ->andWhere($query->expr()->isNull('s2.id')) |
|
89 | - ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id')) |
|
90 | - ->groupBy('s1.parent') |
|
91 | - ->setMaxResults(self::CHUNK_SIZE); |
|
92 | - |
|
93 | - $deleteQuery = $this->connection->getQueryBuilder(); |
|
94 | - $deleteQuery->delete('share') |
|
95 | - ->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent'))); |
|
96 | - |
|
97 | - $deletedInLastChunk = self::CHUNK_SIZE; |
|
98 | - while ($deletedInLastChunk === self::CHUNK_SIZE) { |
|
99 | - $deletedInLastChunk = 0; |
|
100 | - $result = $query->execute(); |
|
101 | - while ($row = $result->fetch()) { |
|
102 | - $deletedInLastChunk++; |
|
103 | - $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent']) |
|
104 | - ->execute(); |
|
105 | - } |
|
106 | - $result->closeCursor(); |
|
107 | - } |
|
108 | - |
|
109 | - if ($deletedEntries) { |
|
110 | - $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist'); |
|
111 | - } |
|
112 | - } |
|
113 | - |
|
114 | - public function run(IOutput $out) { |
|
115 | - $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0'); |
|
116 | - if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) { |
|
117 | - $this->adjustFileSharePermissions($out); |
|
118 | - } |
|
119 | - |
|
120 | - $this->removeSharesNonExistingParent($out); |
|
121 | - } |
|
36 | + const CHUNK_SIZE = 200; |
|
37 | + |
|
38 | + /** @var \OCP\IConfig */ |
|
39 | + protected $config; |
|
40 | + |
|
41 | + /** @var \OCP\IDBConnection */ |
|
42 | + protected $connection; |
|
43 | + |
|
44 | + /** |
|
45 | + * @param \OCP\IConfig $config |
|
46 | + * @param \OCP\IDBConnection $connection |
|
47 | + */ |
|
48 | + public function __construct($config, $connection) { |
|
49 | + $this->connection = $connection; |
|
50 | + $this->config = $config; |
|
51 | + } |
|
52 | + |
|
53 | + public function getName() { |
|
54 | + return 'Repair invalid shares'; |
|
55 | + } |
|
56 | + |
|
57 | + /** |
|
58 | + * Adjust file share permissions |
|
59 | + * @suppress SqlInjectionChecker |
|
60 | + */ |
|
61 | + private function adjustFileSharePermissions(IOutput $out) { |
|
62 | + $mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE; |
|
63 | + $builder = $this->connection->getQueryBuilder(); |
|
64 | + |
|
65 | + $permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask); |
|
66 | + $builder |
|
67 | + ->update('share') |
|
68 | + ->set('permissions', $permsFunc) |
|
69 | + ->where($builder->expr()->eq('item_type', $builder->expr()->literal('file'))) |
|
70 | + ->andWhere($builder->expr()->neq('permissions', $permsFunc)); |
|
71 | + |
|
72 | + $updatedEntries = $builder->execute(); |
|
73 | + if ($updatedEntries > 0) { |
|
74 | + $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares'); |
|
75 | + } |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Remove shares where the parent share does not exist anymore |
|
80 | + */ |
|
81 | + private function removeSharesNonExistingParent(IOutput $out) { |
|
82 | + $deletedEntries = 0; |
|
83 | + |
|
84 | + $query = $this->connection->getQueryBuilder(); |
|
85 | + $query->select('s1.parent') |
|
86 | + ->from('share', 's1') |
|
87 | + ->where($query->expr()->isNotNull('s1.parent')) |
|
88 | + ->andWhere($query->expr()->isNull('s2.id')) |
|
89 | + ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id')) |
|
90 | + ->groupBy('s1.parent') |
|
91 | + ->setMaxResults(self::CHUNK_SIZE); |
|
92 | + |
|
93 | + $deleteQuery = $this->connection->getQueryBuilder(); |
|
94 | + $deleteQuery->delete('share') |
|
95 | + ->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent'))); |
|
96 | + |
|
97 | + $deletedInLastChunk = self::CHUNK_SIZE; |
|
98 | + while ($deletedInLastChunk === self::CHUNK_SIZE) { |
|
99 | + $deletedInLastChunk = 0; |
|
100 | + $result = $query->execute(); |
|
101 | + while ($row = $result->fetch()) { |
|
102 | + $deletedInLastChunk++; |
|
103 | + $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent']) |
|
104 | + ->execute(); |
|
105 | + } |
|
106 | + $result->closeCursor(); |
|
107 | + } |
|
108 | + |
|
109 | + if ($deletedEntries) { |
|
110 | + $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist'); |
|
111 | + } |
|
112 | + } |
|
113 | + |
|
114 | + public function run(IOutput $out) { |
|
115 | + $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0'); |
|
116 | + if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) { |
|
117 | + $this->adjustFileSharePermissions($out); |
|
118 | + } |
|
119 | + |
|
120 | + $this->removeSharesNonExistingParent($out); |
|
121 | + } |
|
122 | 122 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ], |
55 | 55 | ]; |
56 | 56 | |
57 | - if($this->appManager->isEnabledForUser('files_sharing')) { |
|
57 | + if ($this->appManager->isEnabledForUser('files_sharing')) { |
|
58 | 58 | $services['SHARING'] = [ |
59 | 59 | 'version' => 1, |
60 | 60 | 'endpoints' => [ |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if($this->appManager->isEnabledForUser('activity')) { |
|
88 | + if ($this->appManager->isEnabledForUser('activity')) { |
|
89 | 89 | $services['ACTIVITY'] = [ |
90 | 90 | 'version' => 1, |
91 | 91 | 'endpoints' => [ |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ]; |
95 | 95 | } |
96 | 96 | |
97 | - if($this->appManager->isEnabledForUser('provisioning_api')) { |
|
97 | + if ($this->appManager->isEnabledForUser('provisioning_api')) { |
|
98 | 98 | $services['PROVISIONING'] = [ |
99 | 99 | 'version' => 1, |
100 | 100 | 'endpoints' => [ |
@@ -24,92 +24,92 @@ |
||
24 | 24 | namespace OC\OCS; |
25 | 25 | |
26 | 26 | class Provider extends \OCP\AppFramework\Controller { |
27 | - /** @var \OCP\App\IAppManager */ |
|
28 | - private $appManager; |
|
27 | + /** @var \OCP\App\IAppManager */ |
|
28 | + private $appManager; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @param string $appName |
|
32 | - * @param \OCP\IRequest $request |
|
33 | - * @param \OCP\App\IAppManager $appManager |
|
34 | - */ |
|
35 | - public function __construct($appName, |
|
36 | - \OCP\IRequest $request, |
|
37 | - \OCP\App\IAppManager $appManager) { |
|
38 | - parent::__construct($appName, $request); |
|
39 | - $this->appManager = $appManager; |
|
40 | - } |
|
30 | + /** |
|
31 | + * @param string $appName |
|
32 | + * @param \OCP\IRequest $request |
|
33 | + * @param \OCP\App\IAppManager $appManager |
|
34 | + */ |
|
35 | + public function __construct($appName, |
|
36 | + \OCP\IRequest $request, |
|
37 | + \OCP\App\IAppManager $appManager) { |
|
38 | + parent::__construct($appName, $request); |
|
39 | + $this->appManager = $appManager; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return \OCP\AppFramework\Http\JSONResponse |
|
44 | - */ |
|
45 | - public function buildProviderList() { |
|
46 | - $services = [ |
|
47 | - 'PRIVATE_DATA' => [ |
|
48 | - 'version' => 1, |
|
49 | - 'endpoints' => [ |
|
50 | - 'store' => '/ocs/v2.php/privatedata/setattribute', |
|
51 | - 'read' => '/ocs/v2.php/privatedata/getattribute', |
|
52 | - 'delete' => '/ocs/v2.php/privatedata/deleteattribute', |
|
53 | - ], |
|
54 | - ], |
|
55 | - ]; |
|
42 | + /** |
|
43 | + * @return \OCP\AppFramework\Http\JSONResponse |
|
44 | + */ |
|
45 | + public function buildProviderList() { |
|
46 | + $services = [ |
|
47 | + 'PRIVATE_DATA' => [ |
|
48 | + 'version' => 1, |
|
49 | + 'endpoints' => [ |
|
50 | + 'store' => '/ocs/v2.php/privatedata/setattribute', |
|
51 | + 'read' => '/ocs/v2.php/privatedata/getattribute', |
|
52 | + 'delete' => '/ocs/v2.php/privatedata/deleteattribute', |
|
53 | + ], |
|
54 | + ], |
|
55 | + ]; |
|
56 | 56 | |
57 | - if($this->appManager->isEnabledForUser('files_sharing')) { |
|
58 | - $services['SHARING'] = [ |
|
59 | - 'version' => 1, |
|
60 | - 'endpoints' => [ |
|
61 | - 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares', |
|
62 | - ], |
|
63 | - ]; |
|
64 | - $services['FEDERATED_SHARING'] = [ |
|
65 | - 'version' => 1, |
|
66 | - 'endpoints' => [ |
|
67 | - 'share' => '/ocs/v2.php/cloud/shares', |
|
68 | - 'webdav' => '/public.php/webdav/', |
|
69 | - ], |
|
70 | - ]; |
|
71 | - } |
|
57 | + if($this->appManager->isEnabledForUser('files_sharing')) { |
|
58 | + $services['SHARING'] = [ |
|
59 | + 'version' => 1, |
|
60 | + 'endpoints' => [ |
|
61 | + 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares', |
|
62 | + ], |
|
63 | + ]; |
|
64 | + $services['FEDERATED_SHARING'] = [ |
|
65 | + 'version' => 1, |
|
66 | + 'endpoints' => [ |
|
67 | + 'share' => '/ocs/v2.php/cloud/shares', |
|
68 | + 'webdav' => '/public.php/webdav/', |
|
69 | + ], |
|
70 | + ]; |
|
71 | + } |
|
72 | 72 | |
73 | - if ($this->appManager->isEnabledForUser('federation')) { |
|
74 | - if (isset($services['FEDERATED_SHARING'])) { |
|
75 | - $services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret'; |
|
76 | - $services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system'; |
|
77 | - $services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system'; |
|
78 | - } else { |
|
79 | - $services['FEDERATED_SHARING'] = [ |
|
80 | - 'version' => 1, |
|
81 | - 'endpoints' => [ |
|
82 | - 'shared-secret' => '/ocs/v2.php/cloud/shared-secret', |
|
83 | - 'system-address-book' => '/remote.php/dav/addressbooks/system/system/system', |
|
84 | - 'carddav-user' => 'system' |
|
85 | - ], |
|
86 | - ]; |
|
87 | - } |
|
88 | - } |
|
73 | + if ($this->appManager->isEnabledForUser('federation')) { |
|
74 | + if (isset($services['FEDERATED_SHARING'])) { |
|
75 | + $services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret'; |
|
76 | + $services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system'; |
|
77 | + $services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system'; |
|
78 | + } else { |
|
79 | + $services['FEDERATED_SHARING'] = [ |
|
80 | + 'version' => 1, |
|
81 | + 'endpoints' => [ |
|
82 | + 'shared-secret' => '/ocs/v2.php/cloud/shared-secret', |
|
83 | + 'system-address-book' => '/remote.php/dav/addressbooks/system/system/system', |
|
84 | + 'carddav-user' => 'system' |
|
85 | + ], |
|
86 | + ]; |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | - if($this->appManager->isEnabledForUser('activity')) { |
|
91 | - $services['ACTIVITY'] = [ |
|
92 | - 'version' => 1, |
|
93 | - 'endpoints' => [ |
|
94 | - 'list' => '/ocs/v2.php/cloud/activity', |
|
95 | - ], |
|
96 | - ]; |
|
97 | - } |
|
90 | + if($this->appManager->isEnabledForUser('activity')) { |
|
91 | + $services['ACTIVITY'] = [ |
|
92 | + 'version' => 1, |
|
93 | + 'endpoints' => [ |
|
94 | + 'list' => '/ocs/v2.php/cloud/activity', |
|
95 | + ], |
|
96 | + ]; |
|
97 | + } |
|
98 | 98 | |
99 | - if($this->appManager->isEnabledForUser('provisioning_api')) { |
|
100 | - $services['PROVISIONING'] = [ |
|
101 | - 'version' => 1, |
|
102 | - 'endpoints' => [ |
|
103 | - 'user' => '/ocs/v2.php/cloud/users', |
|
104 | - 'groups' => '/ocs/v2.php/cloud/groups', |
|
105 | - 'apps' => '/ocs/v2.php/cloud/apps', |
|
106 | - ], |
|
107 | - ]; |
|
108 | - } |
|
99 | + if($this->appManager->isEnabledForUser('provisioning_api')) { |
|
100 | + $services['PROVISIONING'] = [ |
|
101 | + 'version' => 1, |
|
102 | + 'endpoints' => [ |
|
103 | + 'user' => '/ocs/v2.php/cloud/users', |
|
104 | + 'groups' => '/ocs/v2.php/cloud/groups', |
|
105 | + 'apps' => '/ocs/v2.php/cloud/apps', |
|
106 | + ], |
|
107 | + ]; |
|
108 | + } |
|
109 | 109 | |
110 | - return new \OCP\AppFramework\Http\JSONResponse([ |
|
111 | - 'version' => 2, |
|
112 | - 'services' => $services, |
|
113 | - ]); |
|
114 | - } |
|
110 | + return new \OCP\AppFramework\Http\JSONResponse([ |
|
111 | + 'version' => 2, |
|
112 | + 'services' => $services, |
|
113 | + ]); |
|
114 | + } |
|
115 | 115 | } |
@@ -16,8 +16,11 @@ |
||
16 | 16 | <?php if ($error): ?> |
17 | 17 | <?php if($error_message): ?> |
18 | 18 | <p><strong><?php p($error_message); ?></strong></p> |
19 | - <?php else: ?> |
|
20 | - <p><strong><?php p($l->t('Error while validating your second factor')); ?></strong></p> |
|
19 | + <?php else { |
|
20 | + : ?> |
|
21 | + <p><strong><?php p($l->t('Error while validating your second factor')); |
|
22 | +} |
|
23 | +?></strong></p> |
|
21 | 24 | <?php endif; ?> |
22 | 25 | <?php endif; ?> |
23 | 26 | <?php print_unescaped($template); ?> |
@@ -24,11 +24,11 @@ |
||
24 | 24 | <?php if (!is_null($_['backupProvider'])): ?> |
25 | 25 | <p> |
26 | 26 | <a class="two-factor-secondary" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', |
27 | - [ |
|
28 | - 'challengeProviderId' => $_['backupProvider']->getId(), |
|
29 | - 'redirect_url' => $_['redirect_url'], |
|
30 | - ] |
|
31 | - )) ?>"> |
|
27 | + [ |
|
28 | + 'challengeProviderId' => $_['backupProvider']->getId(), |
|
29 | + 'redirect_url' => $_['redirect_url'], |
|
30 | + ] |
|
31 | + )) ?>"> |
|
32 | 32 | <?php p($l->t('Use backup code')) ?> |
33 | 33 | </a> |
34 | 34 | </p> |
@@ -14,7 +14,7 @@ |
||
14 | 14 | <div class="body-login-container update"> |
15 | 15 | <h2 class="two-factor-header"><?php p($provider->getDisplayName()); ?></h2> |
16 | 16 | <?php if ($error): ?> |
17 | - <?php if($error_message): ?> |
|
17 | + <?php if ($error_message): ?> |
|
18 | 18 | <p><strong><?php p($error_message); ?></strong></p> |
19 | 19 | <?php else: ?> |
20 | 20 | <p><strong><?php p($l->t('Error while validating your second factor')); ?></strong></p> |
@@ -27,41 +27,41 @@ |
||
27 | 27 | * @since 12.0.0 |
28 | 28 | */ |
29 | 29 | interface ISearchQuery { |
30 | - /** |
|
31 | - * @return ISearchOperator |
|
32 | - * @since 12.0.0 |
|
33 | - */ |
|
34 | - public function getSearchOperation(); |
|
30 | + /** |
|
31 | + * @return ISearchOperator |
|
32 | + * @since 12.0.0 |
|
33 | + */ |
|
34 | + public function getSearchOperation(); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Get the maximum number of results to return |
|
38 | - * |
|
39 | - * @return integer |
|
40 | - * @since 12.0.0 |
|
41 | - */ |
|
42 | - public function getLimit(); |
|
36 | + /** |
|
37 | + * Get the maximum number of results to return |
|
38 | + * |
|
39 | + * @return integer |
|
40 | + * @since 12.0.0 |
|
41 | + */ |
|
42 | + public function getLimit(); |
|
43 | 43 | |
44 | - /** |
|
45 | - * Get the offset for returned results |
|
46 | - * |
|
47 | - * @return integer |
|
48 | - * @since 12.0.0 |
|
49 | - */ |
|
50 | - public function getOffset(); |
|
44 | + /** |
|
45 | + * Get the offset for returned results |
|
46 | + * |
|
47 | + * @return integer |
|
48 | + * @since 12.0.0 |
|
49 | + */ |
|
50 | + public function getOffset(); |
|
51 | 51 | |
52 | - /** |
|
53 | - * The fields and directions to order by |
|
54 | - * |
|
55 | - * @return ISearchOrder[] |
|
56 | - * @since 12.0.0 |
|
57 | - */ |
|
58 | - public function getOrder(); |
|
52 | + /** |
|
53 | + * The fields and directions to order by |
|
54 | + * |
|
55 | + * @return ISearchOrder[] |
|
56 | + * @since 12.0.0 |
|
57 | + */ |
|
58 | + public function getOrder(); |
|
59 | 59 | |
60 | - /** |
|
61 | - * The user that issued the search |
|
62 | - * |
|
63 | - * @return IUser |
|
64 | - * @since 12.0.0 |
|
65 | - */ |
|
66 | - public function getUser(); |
|
60 | + /** |
|
61 | + * The user that issued the search |
|
62 | + * |
|
63 | + * @return IUser |
|
64 | + * @since 12.0.0 |
|
65 | + */ |
|
66 | + public function getUser(); |
|
67 | 67 | } |
@@ -27,66 +27,66 @@ |
||
27 | 27 | use OCP\IUser; |
28 | 28 | |
29 | 29 | class SearchQuery implements ISearchQuery { |
30 | - /** @var ISearchOperator */ |
|
31 | - private $searchOperation; |
|
32 | - /** @var integer */ |
|
33 | - private $limit; |
|
34 | - /** @var integer */ |
|
35 | - private $offset; |
|
36 | - /** @var ISearchOrder[] */ |
|
37 | - private $order; |
|
38 | - /** @var IUser */ |
|
39 | - private $user; |
|
30 | + /** @var ISearchOperator */ |
|
31 | + private $searchOperation; |
|
32 | + /** @var integer */ |
|
33 | + private $limit; |
|
34 | + /** @var integer */ |
|
35 | + private $offset; |
|
36 | + /** @var ISearchOrder[] */ |
|
37 | + private $order; |
|
38 | + /** @var IUser */ |
|
39 | + private $user; |
|
40 | 40 | |
41 | - /** |
|
42 | - * SearchQuery constructor. |
|
43 | - * |
|
44 | - * @param ISearchOperator $searchOperation |
|
45 | - * @param int $limit |
|
46 | - * @param int $offset |
|
47 | - * @param array $order |
|
48 | - * @param IUser $user |
|
49 | - */ |
|
50 | - public function __construct(ISearchOperator $searchOperation, $limit, $offset, array $order, IUser $user) { |
|
51 | - $this->searchOperation = $searchOperation; |
|
52 | - $this->limit = $limit; |
|
53 | - $this->offset = $offset; |
|
54 | - $this->order = $order; |
|
55 | - $this->user = $user; |
|
56 | - } |
|
41 | + /** |
|
42 | + * SearchQuery constructor. |
|
43 | + * |
|
44 | + * @param ISearchOperator $searchOperation |
|
45 | + * @param int $limit |
|
46 | + * @param int $offset |
|
47 | + * @param array $order |
|
48 | + * @param IUser $user |
|
49 | + */ |
|
50 | + public function __construct(ISearchOperator $searchOperation, $limit, $offset, array $order, IUser $user) { |
|
51 | + $this->searchOperation = $searchOperation; |
|
52 | + $this->limit = $limit; |
|
53 | + $this->offset = $offset; |
|
54 | + $this->order = $order; |
|
55 | + $this->user = $user; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return ISearchOperator |
|
60 | - */ |
|
61 | - public function getSearchOperation() { |
|
62 | - return $this->searchOperation; |
|
63 | - } |
|
58 | + /** |
|
59 | + * @return ISearchOperator |
|
60 | + */ |
|
61 | + public function getSearchOperation() { |
|
62 | + return $this->searchOperation; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return int |
|
67 | - */ |
|
68 | - public function getLimit() { |
|
69 | - return $this->limit; |
|
70 | - } |
|
65 | + /** |
|
66 | + * @return int |
|
67 | + */ |
|
68 | + public function getLimit() { |
|
69 | + return $this->limit; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @return int |
|
74 | - */ |
|
75 | - public function getOffset() { |
|
76 | - return $this->offset; |
|
77 | - } |
|
72 | + /** |
|
73 | + * @return int |
|
74 | + */ |
|
75 | + public function getOffset() { |
|
76 | + return $this->offset; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @return ISearchOrder[] |
|
81 | - */ |
|
82 | - public function getOrder() { |
|
83 | - return $this->order; |
|
84 | - } |
|
79 | + /** |
|
80 | + * @return ISearchOrder[] |
|
81 | + */ |
|
82 | + public function getOrder() { |
|
83 | + return $this->order; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @return IUser |
|
88 | - */ |
|
89 | - public function getUser() { |
|
90 | - return $this->user; |
|
91 | - } |
|
86 | + /** |
|
87 | + * @return IUser |
|
88 | + */ |
|
89 | + public function getUser() { |
|
90 | + return $this->user; |
|
91 | + } |
|
92 | 92 | } |
@@ -23,18 +23,18 @@ |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | return [ |
26 | - 'routes' => [ |
|
27 | - ['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'], |
|
28 | - ['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'], |
|
29 | - ], |
|
30 | - 'ocs' => [ |
|
31 | - ['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'], |
|
32 | - ['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'], |
|
33 | - ['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'], |
|
34 | - ['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'], |
|
35 | - ['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'], |
|
36 | - ['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'], |
|
37 | - ['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'], |
|
38 | - ['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'], |
|
39 | - ], |
|
26 | + 'routes' => [ |
|
27 | + ['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'], |
|
28 | + ['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'], |
|
29 | + ], |
|
30 | + 'ocs' => [ |
|
31 | + ['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'], |
|
32 | + ['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'], |
|
33 | + ['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'], |
|
34 | + ['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'], |
|
35 | + ['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'], |
|
36 | + ['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'], |
|
37 | + ['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'], |
|
38 | + ['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'], |
|
39 | + ], |
|
40 | 40 | ]; |