@@ -26,61 +26,61 @@ |
||
26 | 26 | |
27 | 27 | interface ILDAPGroupPlugin { |
28 | 28 | |
29 | - /** |
|
30 | - * Check if plugin implements actions |
|
31 | - * @return int |
|
32 | - * |
|
33 | - * Returns the supported actions as int to be |
|
34 | - * compared with OC_GROUP_BACKEND_CREATE_GROUP etc. |
|
35 | - */ |
|
36 | - public function respondToActions(); |
|
29 | + /** |
|
30 | + * Check if plugin implements actions |
|
31 | + * @return int |
|
32 | + * |
|
33 | + * Returns the supported actions as int to be |
|
34 | + * compared with OC_GROUP_BACKEND_CREATE_GROUP etc. |
|
35 | + */ |
|
36 | + public function respondToActions(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $gid |
|
40 | - * @return string|null The group DN if group creation was successful. |
|
41 | - */ |
|
42 | - public function createGroup($gid); |
|
38 | + /** |
|
39 | + * @param string $gid |
|
40 | + * @return string|null The group DN if group creation was successful. |
|
41 | + */ |
|
42 | + public function createGroup($gid); |
|
43 | 43 | |
44 | - /** |
|
45 | - * delete a group |
|
46 | - * @param string $gid gid of the group to delete |
|
47 | - * @return bool |
|
48 | - */ |
|
49 | - public function deleteGroup($gid); |
|
44 | + /** |
|
45 | + * delete a group |
|
46 | + * @param string $gid gid of the group to delete |
|
47 | + * @return bool |
|
48 | + */ |
|
49 | + public function deleteGroup($gid); |
|
50 | 50 | |
51 | - /** |
|
52 | - * Add a user to a group |
|
53 | - * @param string $uid Name of the user to add to group |
|
54 | - * @param string $gid Name of the group in which add the user |
|
55 | - * @return bool |
|
56 | - * |
|
57 | - * Adds a user to a group. |
|
58 | - */ |
|
59 | - public function addToGroup($uid, $gid); |
|
51 | + /** |
|
52 | + * Add a user to a group |
|
53 | + * @param string $uid Name of the user to add to group |
|
54 | + * @param string $gid Name of the group in which add the user |
|
55 | + * @return bool |
|
56 | + * |
|
57 | + * Adds a user to a group. |
|
58 | + */ |
|
59 | + public function addToGroup($uid, $gid); |
|
60 | 60 | |
61 | - /** |
|
62 | - * Removes a user from a group |
|
63 | - * @param string $uid Name of the user to remove from group |
|
64 | - * @param string $gid Name of the group from which remove the user |
|
65 | - * @return bool |
|
66 | - * |
|
67 | - * removes the user from a group. |
|
68 | - */ |
|
69 | - public function removeFromGroup($uid, $gid); |
|
61 | + /** |
|
62 | + * Removes a user from a group |
|
63 | + * @param string $uid Name of the user to remove from group |
|
64 | + * @param string $gid Name of the group from which remove the user |
|
65 | + * @return bool |
|
66 | + * |
|
67 | + * removes the user from a group. |
|
68 | + */ |
|
69 | + public function removeFromGroup($uid, $gid); |
|
70 | 70 | |
71 | - /** |
|
72 | - * get the number of all users matching the search string in a group |
|
73 | - * @param string $gid |
|
74 | - * @param string $search |
|
75 | - * @return int|false |
|
76 | - */ |
|
77 | - public function countUsersInGroup($gid, $search = ''); |
|
71 | + /** |
|
72 | + * get the number of all users matching the search string in a group |
|
73 | + * @param string $gid |
|
74 | + * @param string $search |
|
75 | + * @return int|false |
|
76 | + */ |
|
77 | + public function countUsersInGroup($gid, $search = ''); |
|
78 | 78 | |
79 | - /** |
|
80 | - * get an array with group details |
|
81 | - * @param string $gid |
|
82 | - * @return array|false |
|
83 | - */ |
|
84 | - public function getGroupDetails($gid); |
|
79 | + /** |
|
80 | + * get an array with group details |
|
81 | + * @param string $gid |
|
82 | + * @return array|false |
|
83 | + */ |
|
84 | + public function getGroupDetails($gid); |
|
85 | 85 | |
86 | 86 | } |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <div class="ldapWizardControls"> |
2 | - <span class="ldap_saving hidden"><?php p($l->t('Saving'));?> <img class="wizSpinner" src="<?php p(image_path('core', 'loading.gif')); ?>"/></span> |
|
2 | + <span class="ldap_saving hidden"><?php p($l->t('Saving')); ?> <img class="wizSpinner" src="<?php p(image_path('core', 'loading.gif')); ?>"/></span> |
|
3 | 3 | <span class="ldap_config_state_indicator"></span> <span class="ldap_config_state_indicator_sign"></span> |
4 | 4 | <button class="ldap_action_back invisible" name="ldap_action_back" |
5 | 5 | type="button"> |
6 | - <?php p($l->t('Back'));?> |
|
6 | + <?php p($l->t('Back')); ?> |
|
7 | 7 | </button> |
8 | 8 | <button class="ldap_action_continue primary" name="ldap_action_continue" type="button"> |
9 | - <?php p($l->t('Continue'));?> |
|
9 | + <?php p($l->t('Continue')); ?> |
|
10 | 10 | </button> |
11 | 11 | <a href="<?php p(link_to_docs('admin-ldap')); ?>" |
12 | 12 | target="_blank" rel="noreferrer noopener"> |
13 | 13 | <img src="<?php print_unescaped(image_path('', 'actions/info.svg')); ?>" |
14 | 14 | style="height:1.75ex" /> |
15 | - <span class="ldap_grey"><?php p($l->t('Help'));?></span> |
|
15 | + <span class="ldap_grey"><?php p($l->t('Help')); ?></span> |
|
16 | 16 | </a> |
17 | 17 | </div> |
@@ -30,12 +30,12 @@ |
||
30 | 30 | */ |
31 | 31 | interface IReporter { |
32 | 32 | |
33 | - /** |
|
34 | - * Report an (unhandled) exception |
|
35 | - * |
|
36 | - * @since 13.0.0 |
|
37 | - * @param Exception|Throwable $exception |
|
38 | - * @param array $context |
|
39 | - */ |
|
40 | - public function report($exception, array $context = []); |
|
33 | + /** |
|
34 | + * Report an (unhandled) exception |
|
35 | + * |
|
36 | + * @since 13.0.0 |
|
37 | + * @param Exception|Throwable $exception |
|
38 | + * @param array $context |
|
39 | + */ |
|
40 | + public function report($exception, array $context = []); |
|
41 | 41 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $res['group'] = []; |
88 | 88 | $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
89 | 89 | $res['group']['expire_date']['enabled'] = true; |
90 | - $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
90 | + $res['default_permissions'] = (int) $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | //Federated sharing |
@@ -36,92 +36,92 @@ |
||
36 | 36 | */ |
37 | 37 | class Capabilities implements ICapability { |
38 | 38 | |
39 | - /** @var IConfig */ |
|
40 | - private $config; |
|
41 | - |
|
42 | - public function __construct(IConfig $config) { |
|
43 | - $this->config = $config; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Return this classes capabilities |
|
48 | - * |
|
49 | - * @return array |
|
50 | - */ |
|
51 | - public function getCapabilities() { |
|
52 | - $res = []; |
|
53 | - |
|
54 | - if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
55 | - $res['api_enabled'] = false; |
|
56 | - $res['public'] = ['enabled' => false]; |
|
57 | - $res['user'] = ['send_mail' => false]; |
|
58 | - $res['resharing'] = false; |
|
59 | - } else { |
|
60 | - $res['api_enabled'] = true; |
|
61 | - |
|
62 | - $public = []; |
|
63 | - $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
64 | - if ($public['enabled']) { |
|
65 | - $public['password'] = []; |
|
66 | - $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
67 | - |
|
68 | - if ($public['password']['enforced']) { |
|
69 | - $public['password']['askForOptionalPassword'] = false; |
|
70 | - } else { |
|
71 | - $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes'); |
|
72 | - } |
|
73 | - |
|
74 | - $public['expire_date'] = []; |
|
75 | - $public['multiple_links'] = true; |
|
76 | - $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
77 | - if ($public['expire_date']['enabled']) { |
|
78 | - $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
79 | - $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
80 | - } |
|
81 | - |
|
82 | - $public['expire_date_internal'] = []; |
|
83 | - $public['expire_date_internal']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; |
|
84 | - if ($public['expire_date_internal']['enabled']) { |
|
85 | - $public['expire_date_internal']['days'] = $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
86 | - $public['expire_date_internal']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; |
|
87 | - } |
|
88 | - |
|
89 | - $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
90 | - $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
91 | - $public['upload_files_drop'] = $public['upload']; |
|
92 | - } |
|
93 | - $res['public'] = $public; |
|
94 | - |
|
95 | - $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
96 | - |
|
97 | - $res['user']['send_mail'] = false; |
|
98 | - $res['user']['expire_date']['enabled'] = true; |
|
99 | - |
|
100 | - // deprecated in favour of 'group', but we need to keep it for now |
|
101 | - // in order to stay compatible with older clients |
|
102 | - $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
103 | - |
|
104 | - $res['group'] = []; |
|
105 | - $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
106 | - $res['group']['expire_date']['enabled'] = true; |
|
107 | - $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
108 | - } |
|
109 | - |
|
110 | - //Federated sharing |
|
111 | - $res['federation'] = [ |
|
112 | - 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
113 | - 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
114 | - 'expire_date' => ['enabled' => true] |
|
115 | - ]; |
|
116 | - |
|
117 | - // Sharee searches |
|
118 | - $res['sharee'] = [ |
|
119 | - 'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false), |
|
120 | - 'always_show_unique' => $this->config->getAppValue('files_sharing', 'always_show_unique', 'yes') === 'yes', |
|
121 | - ]; |
|
122 | - |
|
123 | - return [ |
|
124 | - 'files_sharing' => $res, |
|
125 | - ]; |
|
126 | - } |
|
39 | + /** @var IConfig */ |
|
40 | + private $config; |
|
41 | + |
|
42 | + public function __construct(IConfig $config) { |
|
43 | + $this->config = $config; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Return this classes capabilities |
|
48 | + * |
|
49 | + * @return array |
|
50 | + */ |
|
51 | + public function getCapabilities() { |
|
52 | + $res = []; |
|
53 | + |
|
54 | + if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
55 | + $res['api_enabled'] = false; |
|
56 | + $res['public'] = ['enabled' => false]; |
|
57 | + $res['user'] = ['send_mail' => false]; |
|
58 | + $res['resharing'] = false; |
|
59 | + } else { |
|
60 | + $res['api_enabled'] = true; |
|
61 | + |
|
62 | + $public = []; |
|
63 | + $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
64 | + if ($public['enabled']) { |
|
65 | + $public['password'] = []; |
|
66 | + $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
67 | + |
|
68 | + if ($public['password']['enforced']) { |
|
69 | + $public['password']['askForOptionalPassword'] = false; |
|
70 | + } else { |
|
71 | + $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes'); |
|
72 | + } |
|
73 | + |
|
74 | + $public['expire_date'] = []; |
|
75 | + $public['multiple_links'] = true; |
|
76 | + $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
77 | + if ($public['expire_date']['enabled']) { |
|
78 | + $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
79 | + $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
80 | + } |
|
81 | + |
|
82 | + $public['expire_date_internal'] = []; |
|
83 | + $public['expire_date_internal']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; |
|
84 | + if ($public['expire_date_internal']['enabled']) { |
|
85 | + $public['expire_date_internal']['days'] = $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
86 | + $public['expire_date_internal']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; |
|
87 | + } |
|
88 | + |
|
89 | + $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
90 | + $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
91 | + $public['upload_files_drop'] = $public['upload']; |
|
92 | + } |
|
93 | + $res['public'] = $public; |
|
94 | + |
|
95 | + $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
96 | + |
|
97 | + $res['user']['send_mail'] = false; |
|
98 | + $res['user']['expire_date']['enabled'] = true; |
|
99 | + |
|
100 | + // deprecated in favour of 'group', but we need to keep it for now |
|
101 | + // in order to stay compatible with older clients |
|
102 | + $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
103 | + |
|
104 | + $res['group'] = []; |
|
105 | + $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
106 | + $res['group']['expire_date']['enabled'] = true; |
|
107 | + $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
108 | + } |
|
109 | + |
|
110 | + //Federated sharing |
|
111 | + $res['federation'] = [ |
|
112 | + 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
113 | + 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
114 | + 'expire_date' => ['enabled' => true] |
|
115 | + ]; |
|
116 | + |
|
117 | + // Sharee searches |
|
118 | + $res['sharee'] = [ |
|
119 | + 'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false), |
|
120 | + 'always_show_unique' => $this->config->getAppValue('files_sharing', 'always_show_unique', 'yes') === 'yes', |
|
121 | + ]; |
|
122 | + |
|
123 | + return [ |
|
124 | + 'files_sharing' => $res, |
|
125 | + ]; |
|
126 | + } |
|
127 | 127 | } |
@@ -23,18 +23,18 @@ |
||
23 | 23 | * |
24 | 24 | */ |
25 | 25 | |
26 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
27 | -require_once __DIR__ . '/../lib/base.php'; |
|
26 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
27 | +require_once __DIR__.'/../lib/base.php'; |
|
28 | 28 | |
29 | 29 | header('Content-type: application/xml'); |
30 | 30 | |
31 | 31 | $request = \OC::$server->getRequest(); |
32 | 32 | |
33 | -$url = $request->getServerProtocol() . '://' . substr($request->getServerHost() . $request->getRequestUri(), 0, -17).'ocs/v1.php/'; |
|
33 | +$url = $request->getServerProtocol().'://'.substr($request->getServerHost().$request->getRequestUri(), 0, -17).'ocs/v1.php/'; |
|
34 | 34 | |
35 | 35 | $writer = new XMLWriter(); |
36 | 36 | $writer->openURI('php://output'); |
37 | -$writer->startDocument('1.0','UTF-8'); |
|
37 | +$writer->startDocument('1.0', 'UTF-8'); |
|
38 | 38 | $writer->setIndent(true); |
39 | 39 | $writer->startElement('providers'); |
40 | 40 | $writer->startElement('provider'); |
@@ -27,17 +27,17 @@ |
||
27 | 27 | * @since 13.0.0 |
28 | 28 | */ |
29 | 29 | interface ICachedMountFileInfo extends ICachedMountInfo { |
30 | - /** |
|
31 | - * Return the path for the file within the cached mount |
|
32 | - * |
|
33 | - * @return string |
|
34 | - * @since 13.0.0 |
|
35 | - */ |
|
36 | - public function getInternalPath(); |
|
30 | + /** |
|
31 | + * Return the path for the file within the cached mount |
|
32 | + * |
|
33 | + * @return string |
|
34 | + * @since 13.0.0 |
|
35 | + */ |
|
36 | + public function getInternalPath(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return string |
|
40 | - * @since 13.0.0 |
|
41 | - */ |
|
42 | - public function getPath(); |
|
38 | + /** |
|
39 | + * @return string |
|
40 | + * @since 13.0.0 |
|
41 | + */ |
|
42 | + public function getPath(); |
|
43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this |
50 | 50 | ->setIdentifier($invalidId) |
51 | 51 | ->setStorageClass('\OC\Files\Storage\FailedStorage') |
52 | - ->setText('Unknown storage backend ' . $invalidId); |
|
52 | + ->setText('Unknown storage backend '.$invalidId); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
65 | - $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR)); |
|
65 | + $storage->setBackendOption('exception', new \Exception('Unknown storage backend "'.$this->invalidId.'"', StorageNotAvailableException::STATUS_ERROR)); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -34,33 +34,33 @@ |
||
34 | 34 | */ |
35 | 35 | class InvalidBackend extends Backend { |
36 | 36 | |
37 | - /** @var string Invalid backend id */ |
|
38 | - private $invalidId; |
|
37 | + /** @var string Invalid backend id */ |
|
38 | + private $invalidId; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Constructs a new InvalidBackend with the id of the invalid backend |
|
42 | - * for display purposes |
|
43 | - * |
|
44 | - * @param string $invalidId id of the backend that did not exist |
|
45 | - */ |
|
46 | - public function __construct($invalidId) { |
|
47 | - $this->invalidId = $invalidId; |
|
48 | - $this |
|
49 | - ->setIdentifier($invalidId) |
|
50 | - ->setStorageClass('\OC\Files\Storage\FailedStorage') |
|
51 | - ->setText('Unknown storage backend ' . $invalidId); |
|
52 | - } |
|
40 | + /** |
|
41 | + * Constructs a new InvalidBackend with the id of the invalid backend |
|
42 | + * for display purposes |
|
43 | + * |
|
44 | + * @param string $invalidId id of the backend that did not exist |
|
45 | + */ |
|
46 | + public function __construct($invalidId) { |
|
47 | + $this->invalidId = $invalidId; |
|
48 | + $this |
|
49 | + ->setIdentifier($invalidId) |
|
50 | + ->setStorageClass('\OC\Files\Storage\FailedStorage') |
|
51 | + ->setText('Unknown storage backend ' . $invalidId); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Returns the invalid backend id |
|
56 | - * |
|
57 | - * @return string invalid backend id |
|
58 | - */ |
|
59 | - public function getInvalidId() { |
|
60 | - return $this->invalidId; |
|
61 | - } |
|
54 | + /** |
|
55 | + * Returns the invalid backend id |
|
56 | + * |
|
57 | + * @return string invalid backend id |
|
58 | + */ |
|
59 | + public function getInvalidId() { |
|
60 | + return $this->invalidId; |
|
61 | + } |
|
62 | 62 | |
63 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
64 | - $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR)); |
|
65 | - } |
|
63 | + public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
64 | + $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR)); |
|
65 | + } |
|
66 | 66 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $username_as_share = ($storage->getBackendOption('username_as_share') === true); |
66 | 66 | |
67 | 67 | if ($username_as_share) { |
68 | - $share = '/' . $storage->getBackendOption('user'); |
|
68 | + $share = '/'.$storage->getBackendOption('user'); |
|
69 | 69 | $storage->setBackendOption('share', $share); |
70 | 70 | } |
71 | 71 | } |
@@ -37,35 +37,35 @@ |
||
37 | 37 | * Deprecated SMB_OC class - use SMB with the password::sessioncredentials auth mechanism |
38 | 38 | */ |
39 | 39 | class SMB_OC extends Backend { |
40 | - use LegacyDependencyCheckPolyfill; |
|
40 | + use LegacyDependencyCheckPolyfill; |
|
41 | 41 | |
42 | - public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) { |
|
43 | - $this |
|
44 | - ->setIdentifier('\OC\Files\Storage\SMB_OC') |
|
45 | - ->setStorageClass('\OCA\Files_External\Lib\Storage\SMB') |
|
46 | - ->setText($l->t('SMB / CIFS using OC login')) |
|
47 | - ->addParameters([ |
|
48 | - new DefinitionParameter('host', $l->t('Host')), |
|
49 | - (new DefinitionParameter('username_as_share', $l->t('Username as share'))) |
|
50 | - ->setType(DefinitionParameter::VALUE_BOOLEAN), |
|
51 | - (new DefinitionParameter('share', $l->t('Share'))) |
|
52 | - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
53 | - (new DefinitionParameter('root', $l->t('Remote subfolder'))) |
|
54 | - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
55 | - ]) |
|
56 | - ->setPriority(BackendService::PRIORITY_DEFAULT - 10) |
|
57 | - ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) |
|
58 | - ->setLegacyAuthMechanism($legacyAuth) |
|
59 | - ->deprecateTo($smbBackend) |
|
60 | - ; |
|
61 | - } |
|
42 | + public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) { |
|
43 | + $this |
|
44 | + ->setIdentifier('\OC\Files\Storage\SMB_OC') |
|
45 | + ->setStorageClass('\OCA\Files_External\Lib\Storage\SMB') |
|
46 | + ->setText($l->t('SMB / CIFS using OC login')) |
|
47 | + ->addParameters([ |
|
48 | + new DefinitionParameter('host', $l->t('Host')), |
|
49 | + (new DefinitionParameter('username_as_share', $l->t('Username as share'))) |
|
50 | + ->setType(DefinitionParameter::VALUE_BOOLEAN), |
|
51 | + (new DefinitionParameter('share', $l->t('Share'))) |
|
52 | + ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
53 | + (new DefinitionParameter('root', $l->t('Remote subfolder'))) |
|
54 | + ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
55 | + ]) |
|
56 | + ->setPriority(BackendService::PRIORITY_DEFAULT - 10) |
|
57 | + ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) |
|
58 | + ->setLegacyAuthMechanism($legacyAuth) |
|
59 | + ->deprecateTo($smbBackend) |
|
60 | + ; |
|
61 | + } |
|
62 | 62 | |
63 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
64 | - $username_as_share = ($storage->getBackendOption('username_as_share') === true); |
|
63 | + public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
64 | + $username_as_share = ($storage->getBackendOption('username_as_share') === true); |
|
65 | 65 | |
66 | - if ($username_as_share) { |
|
67 | - $share = '/' . $storage->getBackendOption('user'); |
|
68 | - $storage->setBackendOption('share', $share); |
|
69 | - } |
|
70 | - } |
|
66 | + if ($username_as_share) { |
|
67 | + $share = '/' . $storage->getBackendOption('user'); |
|
68 | + $storage->setBackendOption('share', $share); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
@@ -122,7 +122,7 @@ |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
125 | - $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | + $this->dispatcher->dispatch(self::class.'::'.$eventName, new GenericEvent(null, [ |
|
126 | 126 | 'userId' => $user->getUID(), |
127 | 127 | 'fileId' => $fileId, |
128 | 128 | 'path' => $path, |
@@ -38,110 +38,110 @@ |
||
38 | 38 | */ |
39 | 39 | class TagService { |
40 | 40 | |
41 | - /** @var IUserSession */ |
|
42 | - private $userSession; |
|
43 | - /** @var IManager */ |
|
44 | - private $activityManager; |
|
45 | - /** @var ITags */ |
|
46 | - private $tagger; |
|
47 | - /** @var Folder */ |
|
48 | - private $homeFolder; |
|
49 | - /** @var EventDispatcherInterface */ |
|
50 | - private $dispatcher; |
|
41 | + /** @var IUserSession */ |
|
42 | + private $userSession; |
|
43 | + /** @var IManager */ |
|
44 | + private $activityManager; |
|
45 | + /** @var ITags */ |
|
46 | + private $tagger; |
|
47 | + /** @var Folder */ |
|
48 | + private $homeFolder; |
|
49 | + /** @var EventDispatcherInterface */ |
|
50 | + private $dispatcher; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param IUserSession $userSession |
|
54 | - * @param IManager $activityManager |
|
55 | - * @param ITags $tagger |
|
56 | - * @param Folder $homeFolder |
|
57 | - * @param EventDispatcherInterface $dispatcher |
|
58 | - */ |
|
59 | - public function __construct( |
|
60 | - IUserSession $userSession, |
|
61 | - IManager $activityManager, |
|
62 | - ITags $tagger, |
|
63 | - Folder $homeFolder, |
|
64 | - EventDispatcherInterface $dispatcher |
|
65 | - ) { |
|
66 | - $this->userSession = $userSession; |
|
67 | - $this->activityManager = $activityManager; |
|
68 | - $this->tagger = $tagger; |
|
69 | - $this->homeFolder = $homeFolder; |
|
70 | - $this->dispatcher = $dispatcher; |
|
71 | - } |
|
52 | + /** |
|
53 | + * @param IUserSession $userSession |
|
54 | + * @param IManager $activityManager |
|
55 | + * @param ITags $tagger |
|
56 | + * @param Folder $homeFolder |
|
57 | + * @param EventDispatcherInterface $dispatcher |
|
58 | + */ |
|
59 | + public function __construct( |
|
60 | + IUserSession $userSession, |
|
61 | + IManager $activityManager, |
|
62 | + ITags $tagger, |
|
63 | + Folder $homeFolder, |
|
64 | + EventDispatcherInterface $dispatcher |
|
65 | + ) { |
|
66 | + $this->userSession = $userSession; |
|
67 | + $this->activityManager = $activityManager; |
|
68 | + $this->tagger = $tagger; |
|
69 | + $this->homeFolder = $homeFolder; |
|
70 | + $this->dispatcher = $dispatcher; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Updates the tags of the specified file path. |
|
75 | - * The passed tags are absolute, which means they will |
|
76 | - * replace the actual tag selection. |
|
77 | - * |
|
78 | - * @param string $path path |
|
79 | - * @param array $tags array of tags |
|
80 | - * @return array list of tags |
|
81 | - * @throws \OCP\Files\NotFoundException if the file does not exist |
|
82 | - */ |
|
83 | - public function updateFileTags($path, $tags) { |
|
84 | - $fileId = $this->homeFolder->get($path)->getId(); |
|
73 | + /** |
|
74 | + * Updates the tags of the specified file path. |
|
75 | + * The passed tags are absolute, which means they will |
|
76 | + * replace the actual tag selection. |
|
77 | + * |
|
78 | + * @param string $path path |
|
79 | + * @param array $tags array of tags |
|
80 | + * @return array list of tags |
|
81 | + * @throws \OCP\Files\NotFoundException if the file does not exist |
|
82 | + */ |
|
83 | + public function updateFileTags($path, $tags) { |
|
84 | + $fileId = $this->homeFolder->get($path)->getId(); |
|
85 | 85 | |
86 | - $currentTags = $this->tagger->getTagsForObjects([$fileId]); |
|
86 | + $currentTags = $this->tagger->getTagsForObjects([$fileId]); |
|
87 | 87 | |
88 | - if (!empty($currentTags)) { |
|
89 | - $currentTags = current($currentTags); |
|
90 | - } |
|
88 | + if (!empty($currentTags)) { |
|
89 | + $currentTags = current($currentTags); |
|
90 | + } |
|
91 | 91 | |
92 | - $newTags = array_diff($tags, $currentTags); |
|
93 | - foreach ($newTags as $tag) { |
|
94 | - if ($tag === ITags::TAG_FAVORITE) { |
|
95 | - $this->addActivity(true, $fileId, $path); |
|
96 | - } |
|
97 | - $this->tagger->tagAs($fileId, $tag); |
|
98 | - } |
|
99 | - $deletedTags = array_diff($currentTags, $tags); |
|
100 | - foreach ($deletedTags as $tag) { |
|
101 | - if ($tag === ITags::TAG_FAVORITE) { |
|
102 | - $this->addActivity(false, $fileId, $path); |
|
103 | - } |
|
104 | - $this->tagger->unTag($fileId, $tag); |
|
105 | - } |
|
92 | + $newTags = array_diff($tags, $currentTags); |
|
93 | + foreach ($newTags as $tag) { |
|
94 | + if ($tag === ITags::TAG_FAVORITE) { |
|
95 | + $this->addActivity(true, $fileId, $path); |
|
96 | + } |
|
97 | + $this->tagger->tagAs($fileId, $tag); |
|
98 | + } |
|
99 | + $deletedTags = array_diff($currentTags, $tags); |
|
100 | + foreach ($deletedTags as $tag) { |
|
101 | + if ($tag === ITags::TAG_FAVORITE) { |
|
102 | + $this->addActivity(false, $fileId, $path); |
|
103 | + } |
|
104 | + $this->tagger->unTag($fileId, $tag); |
|
105 | + } |
|
106 | 106 | |
107 | - // TODO: re-read from tagger to make sure the |
|
108 | - // list is up to date, in case of concurrent changes ? |
|
109 | - return $tags; |
|
110 | - } |
|
107 | + // TODO: re-read from tagger to make sure the |
|
108 | + // list is up to date, in case of concurrent changes ? |
|
109 | + return $tags; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * @param bool $addToFavorite |
|
114 | - * @param int $fileId |
|
115 | - * @param string $path |
|
116 | - */ |
|
117 | - protected function addActivity($addToFavorite, $fileId, $path) { |
|
118 | - $user = $this->userSession->getUser(); |
|
119 | - if (!$user instanceof IUser) { |
|
120 | - return; |
|
121 | - } |
|
112 | + /** |
|
113 | + * @param bool $addToFavorite |
|
114 | + * @param int $fileId |
|
115 | + * @param string $path |
|
116 | + */ |
|
117 | + protected function addActivity($addToFavorite, $fileId, $path) { |
|
118 | + $user = $this->userSession->getUser(); |
|
119 | + if (!$user instanceof IUser) { |
|
120 | + return; |
|
121 | + } |
|
122 | 122 | |
123 | - $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
|
124 | - $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | - 'userId' => $user->getUID(), |
|
126 | - 'fileId' => $fileId, |
|
127 | - 'path' => $path, |
|
128 | - ])); |
|
123 | + $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
|
124 | + $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | + 'userId' => $user->getUID(), |
|
126 | + 'fileId' => $fileId, |
|
127 | + 'path' => $path, |
|
128 | + ])); |
|
129 | 129 | |
130 | - $event = $this->activityManager->generateEvent(); |
|
131 | - try { |
|
132 | - $event->setApp('files') |
|
133 | - ->setObject('files', $fileId, $path) |
|
134 | - ->setType('favorite') |
|
135 | - ->setAuthor($user->getUID()) |
|
136 | - ->setAffectedUser($user->getUID()) |
|
137 | - ->setTimestamp(time()) |
|
138 | - ->setSubject( |
|
139 | - $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
140 | - ['id' => $fileId, 'path' => $path] |
|
141 | - ); |
|
142 | - $this->activityManager->publish($event); |
|
143 | - } catch (\InvalidArgumentException $e) { |
|
144 | - } catch (\BadMethodCallException $e) { |
|
145 | - } |
|
146 | - } |
|
130 | + $event = $this->activityManager->generateEvent(); |
|
131 | + try { |
|
132 | + $event->setApp('files') |
|
133 | + ->setObject('files', $fileId, $path) |
|
134 | + ->setType('favorite') |
|
135 | + ->setAuthor($user->getUID()) |
|
136 | + ->setAffectedUser($user->getUID()) |
|
137 | + ->setTimestamp(time()) |
|
138 | + ->setSubject( |
|
139 | + $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
140 | + ['id' => $fileId, 'path' => $path] |
|
141 | + ); |
|
142 | + $this->activityManager->publish($event); |
|
143 | + } catch (\InvalidArgumentException $e) { |
|
144 | + } catch (\BadMethodCallException $e) { |
|
145 | + } |
|
146 | + } |
|
147 | 147 | } |