@@ -33,79 +33,79 @@ |
||
33 | 33 | */ |
34 | 34 | class Capabilities implements ICapability { |
35 | 35 | |
36 | - /** @var IConfig */ |
|
37 | - private $config; |
|
38 | - |
|
39 | - public function __construct(IConfig $config) { |
|
40 | - $this->config = $config; |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Return this classes capabilities |
|
45 | - * |
|
46 | - * @return array |
|
47 | - */ |
|
48 | - public function getCapabilities() { |
|
49 | - $res = []; |
|
50 | - |
|
51 | - if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
52 | - $res['api_enabled'] = false; |
|
53 | - $res['public'] = ['enabled' => false]; |
|
54 | - $res['user'] = ['send_mail' => false]; |
|
55 | - $res['resharing'] = false; |
|
56 | - } else { |
|
57 | - $res['api_enabled'] = true; |
|
58 | - |
|
59 | - $public = []; |
|
60 | - $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
61 | - if ($public['enabled']) { |
|
62 | - $public['password'] = []; |
|
63 | - $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
64 | - |
|
65 | - if ($public['password']['enforced']) { |
|
66 | - $public['password']['askForOptionalPassword'] = false; |
|
67 | - } else { |
|
68 | - $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes'); |
|
69 | - } |
|
70 | - |
|
71 | - $public['expire_date'] = []; |
|
72 | - $public['multiple_links'] = true; |
|
73 | - $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
74 | - if ($public['expire_date']['enabled']) { |
|
75 | - $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
76 | - $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
77 | - } |
|
78 | - |
|
79 | - $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
80 | - $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
81 | - $public['upload_files_drop'] = $public['upload']; |
|
82 | - } |
|
83 | - $res['public'] = $public; |
|
84 | - |
|
85 | - $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
86 | - |
|
87 | - $res['user']['send_mail'] = false; |
|
88 | - $res['user']['expire_date']['enabled'] = true; |
|
89 | - |
|
90 | - // deprecated in favour of 'group', but we need to keep it for now |
|
91 | - // in order to stay compatible with older clients |
|
92 | - $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
93 | - |
|
94 | - $res['group'] = []; |
|
95 | - $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
96 | - $res['group']['expire_date']['enabled'] = true; |
|
97 | - $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
98 | - } |
|
99 | - |
|
100 | - //Federated sharing |
|
101 | - $res['federation'] = [ |
|
102 | - 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
103 | - 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
104 | - 'expire_date' => ['enabled' => true] |
|
105 | - ]; |
|
106 | - |
|
107 | - return [ |
|
108 | - 'files_sharing' => $res, |
|
109 | - ]; |
|
110 | - } |
|
36 | + /** @var IConfig */ |
|
37 | + private $config; |
|
38 | + |
|
39 | + public function __construct(IConfig $config) { |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Return this classes capabilities |
|
45 | + * |
|
46 | + * @return array |
|
47 | + */ |
|
48 | + public function getCapabilities() { |
|
49 | + $res = []; |
|
50 | + |
|
51 | + if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
52 | + $res['api_enabled'] = false; |
|
53 | + $res['public'] = ['enabled' => false]; |
|
54 | + $res['user'] = ['send_mail' => false]; |
|
55 | + $res['resharing'] = false; |
|
56 | + } else { |
|
57 | + $res['api_enabled'] = true; |
|
58 | + |
|
59 | + $public = []; |
|
60 | + $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
61 | + if ($public['enabled']) { |
|
62 | + $public['password'] = []; |
|
63 | + $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
64 | + |
|
65 | + if ($public['password']['enforced']) { |
|
66 | + $public['password']['askForOptionalPassword'] = false; |
|
67 | + } else { |
|
68 | + $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes'); |
|
69 | + } |
|
70 | + |
|
71 | + $public['expire_date'] = []; |
|
72 | + $public['multiple_links'] = true; |
|
73 | + $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
74 | + if ($public['expire_date']['enabled']) { |
|
75 | + $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
76 | + $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
77 | + } |
|
78 | + |
|
79 | + $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
80 | + $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
81 | + $public['upload_files_drop'] = $public['upload']; |
|
82 | + } |
|
83 | + $res['public'] = $public; |
|
84 | + |
|
85 | + $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
86 | + |
|
87 | + $res['user']['send_mail'] = false; |
|
88 | + $res['user']['expire_date']['enabled'] = true; |
|
89 | + |
|
90 | + // deprecated in favour of 'group', but we need to keep it for now |
|
91 | + // in order to stay compatible with older clients |
|
92 | + $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
93 | + |
|
94 | + $res['group'] = []; |
|
95 | + $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
96 | + $res['group']['expire_date']['enabled'] = true; |
|
97 | + $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
98 | + } |
|
99 | + |
|
100 | + //Federated sharing |
|
101 | + $res['federation'] = [ |
|
102 | + 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
103 | + 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
104 | + 'expire_date' => ['enabled' => true] |
|
105 | + ]; |
|
106 | + |
|
107 | + return [ |
|
108 | + 'files_sharing' => $res, |
|
109 | + ]; |
|
110 | + } |
|
111 | 111 | } |