@@ -37,101 +37,101 @@ |
||
| 37 | 37 | use OCP\Util; |
| 38 | 38 | |
| 39 | 39 | class Sharing implements ISettings { |
| 40 | - /** @var IConfig */ |
|
| 41 | - private $config; |
|
| 40 | + /** @var IConfig */ |
|
| 41 | + private $config; |
|
| 42 | 42 | |
| 43 | - /** @var IL10N */ |
|
| 44 | - private $l; |
|
| 43 | + /** @var IL10N */ |
|
| 44 | + private $l; |
|
| 45 | 45 | |
| 46 | - /** @var IManager */ |
|
| 47 | - private $shareManager; |
|
| 46 | + /** @var IManager */ |
|
| 47 | + private $shareManager; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param IConfig $config |
|
| 51 | - */ |
|
| 52 | - public function __construct(IConfig $config, IFactory $l, IManager $shareManager) { |
|
| 53 | - $this->config = $config; |
|
| 54 | - $this->l = $l->get('lib'); |
|
| 55 | - $this->shareManager = $shareManager; |
|
| 56 | - } |
|
| 49 | + /** |
|
| 50 | + * @param IConfig $config |
|
| 51 | + */ |
|
| 52 | + public function __construct(IConfig $config, IFactory $l, IManager $shareManager) { |
|
| 53 | + $this->config = $config; |
|
| 54 | + $this->l = $l->get('lib'); |
|
| 55 | + $this->shareManager = $shareManager; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @return TemplateResponse |
|
| 60 | - */ |
|
| 61 | - public function getForm() { |
|
| 62 | - $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); |
|
| 63 | - $excludeGroupsList = !is_null(json_decode($excludedGroups)) |
|
| 64 | - ? implode('|', json_decode($excludedGroups, true)) : ''; |
|
| 58 | + /** |
|
| 59 | + * @return TemplateResponse |
|
| 60 | + */ |
|
| 61 | + public function getForm() { |
|
| 62 | + $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); |
|
| 63 | + $excludeGroupsList = !is_null(json_decode($excludedGroups)) |
|
| 64 | + ? implode('|', json_decode($excludedGroups, true)) : ''; |
|
| 65 | 65 | |
| 66 | - $parameters = [ |
|
| 67 | - // Built-In Sharing |
|
| 68 | - 'allowGroupSharing' => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'), |
|
| 69 | - 'allowLinks' => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'), |
|
| 70 | - 'allowPublicUpload' => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'), |
|
| 71 | - 'allowResharing' => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'), |
|
| 72 | - 'allowShareDialogUserEnumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'), |
|
| 73 | - 'enforceLinkPassword' => Util::isPublicLinkPasswordRequired(), |
|
| 74 | - 'onlyShareWithGroupMembers' => $this->shareManager->shareWithGroupMembersOnly(), |
|
| 75 | - 'shareAPIEnabled' => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'), |
|
| 76 | - 'shareDefaultExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'), |
|
| 77 | - 'shareExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'), |
|
| 78 | - 'shareEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'), |
|
| 79 | - 'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes', |
|
| 80 | - 'shareExcludedGroupsList' => $excludeGroupsList, |
|
| 81 | - 'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null), |
|
| 82 | - 'enableLinkPasswordByDefault' => $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'), |
|
| 83 | - 'shareApiDefaultPermissions' => $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL), |
|
| 84 | - 'shareApiDefaultPermissionsCheckboxes' => $this->getSharePermissionList(), |
|
| 85 | - ]; |
|
| 66 | + $parameters = [ |
|
| 67 | + // Built-In Sharing |
|
| 68 | + 'allowGroupSharing' => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'), |
|
| 69 | + 'allowLinks' => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'), |
|
| 70 | + 'allowPublicUpload' => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'), |
|
| 71 | + 'allowResharing' => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'), |
|
| 72 | + 'allowShareDialogUserEnumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'), |
|
| 73 | + 'enforceLinkPassword' => Util::isPublicLinkPasswordRequired(), |
|
| 74 | + 'onlyShareWithGroupMembers' => $this->shareManager->shareWithGroupMembersOnly(), |
|
| 75 | + 'shareAPIEnabled' => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'), |
|
| 76 | + 'shareDefaultExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'), |
|
| 77 | + 'shareExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'), |
|
| 78 | + 'shareEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'), |
|
| 79 | + 'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes', |
|
| 80 | + 'shareExcludedGroupsList' => $excludeGroupsList, |
|
| 81 | + 'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null), |
|
| 82 | + 'enableLinkPasswordByDefault' => $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'), |
|
| 83 | + 'shareApiDefaultPermissions' => $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL), |
|
| 84 | + 'shareApiDefaultPermissionsCheckboxes' => $this->getSharePermissionList(), |
|
| 85 | + ]; |
|
| 86 | 86 | |
| 87 | - return new TemplateResponse('settings', 'settings/admin/sharing', $parameters, ''); |
|
| 88 | - } |
|
| 87 | + return new TemplateResponse('settings', 'settings/admin/sharing', $parameters, ''); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * get share permission list for template |
|
| 92 | - * |
|
| 93 | - * @return array |
|
| 94 | - */ |
|
| 95 | - private function getSharePermissionList() { |
|
| 96 | - return [ |
|
| 97 | - [ |
|
| 98 | - 'id' => 'cancreate', |
|
| 99 | - 'label' => $this->l->t('Create'), |
|
| 100 | - 'value' => Constants::PERMISSION_CREATE |
|
| 101 | - ], |
|
| 102 | - [ |
|
| 103 | - 'id' => 'canupdate', |
|
| 104 | - 'label' => $this->l->t('Change'), |
|
| 105 | - 'value' => Constants::PERMISSION_UPDATE |
|
| 106 | - ], |
|
| 107 | - [ |
|
| 108 | - 'id' => 'candelete', |
|
| 109 | - 'label' => $this->l->t('Delete'), |
|
| 110 | - 'value' => Constants::PERMISSION_DELETE |
|
| 111 | - ], |
|
| 112 | - [ |
|
| 113 | - 'id' => 'canshare', |
|
| 114 | - 'label' => $this->l->t('Share'), |
|
| 115 | - 'value' => Constants::PERMISSION_SHARE |
|
| 116 | - ], |
|
| 117 | - ]; |
|
| 118 | - } |
|
| 90 | + /** |
|
| 91 | + * get share permission list for template |
|
| 92 | + * |
|
| 93 | + * @return array |
|
| 94 | + */ |
|
| 95 | + private function getSharePermissionList() { |
|
| 96 | + return [ |
|
| 97 | + [ |
|
| 98 | + 'id' => 'cancreate', |
|
| 99 | + 'label' => $this->l->t('Create'), |
|
| 100 | + 'value' => Constants::PERMISSION_CREATE |
|
| 101 | + ], |
|
| 102 | + [ |
|
| 103 | + 'id' => 'canupdate', |
|
| 104 | + 'label' => $this->l->t('Change'), |
|
| 105 | + 'value' => Constants::PERMISSION_UPDATE |
|
| 106 | + ], |
|
| 107 | + [ |
|
| 108 | + 'id' => 'candelete', |
|
| 109 | + 'label' => $this->l->t('Delete'), |
|
| 110 | + 'value' => Constants::PERMISSION_DELETE |
|
| 111 | + ], |
|
| 112 | + [ |
|
| 113 | + 'id' => 'canshare', |
|
| 114 | + 'label' => $this->l->t('Share'), |
|
| 115 | + 'value' => Constants::PERMISSION_SHARE |
|
| 116 | + ], |
|
| 117 | + ]; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * @return string the section ID, e.g. 'sharing' |
|
| 122 | - */ |
|
| 123 | - public function getSection() { |
|
| 124 | - return 'sharing'; |
|
| 125 | - } |
|
| 120 | + /** |
|
| 121 | + * @return string the section ID, e.g. 'sharing' |
|
| 122 | + */ |
|
| 123 | + public function getSection() { |
|
| 124 | + return 'sharing'; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * @return int whether the form should be rather on the top or bottom of |
|
| 129 | - * the admin section. The forms are arranged in ascending order of the |
|
| 130 | - * priority values. It is required to return a value between 0 and 100. |
|
| 131 | - * |
|
| 132 | - * E.g.: 70 |
|
| 133 | - */ |
|
| 134 | - public function getPriority() { |
|
| 135 | - return 0; |
|
| 136 | - } |
|
| 127 | + /** |
|
| 128 | + * @return int whether the form should be rather on the top or bottom of |
|
| 129 | + * the admin section. The forms are arranged in ascending order of the |
|
| 130 | + * priority values. It is required to return a value between 0 and 100. |
|
| 131 | + * |
|
| 132 | + * E.g.: 70 |
|
| 133 | + */ |
|
| 134 | + public function getPriority() { |
|
| 135 | + return 0; |
|
| 136 | + } |
|
| 137 | 137 | } |