aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Listener/LoadSidebarListener.php1
-rw-r--r--apps/files_sharing/src/services/ConfigService.js11
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue34
3 files changed, 34 insertions, 12 deletions
diff --git a/apps/files_sharing/lib/Listener/LoadSidebarListener.php b/apps/files_sharing/lib/Listener/LoadSidebarListener.php
index 8e12e551183..7787a348d3a 100644
--- a/apps/files_sharing/lib/Listener/LoadSidebarListener.php
+++ b/apps/files_sharing/lib/Listener/LoadSidebarListener.php
@@ -51,6 +51,7 @@ class LoadSidebarListener implements IEventListener {
$shareConfig = [
'allowPublicUploads' => $this->shareManager->shareApiLinkAllowPublicUpload(),
+ 'defaultPermissions' => $this->shareManager->shareApiDefaultPermissions(),
];
$this->initialState->provideInitialState('shareConfig', $shareConfig);
diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js
index d1d99e7be7a..8afa41e80e5 100644
--- a/apps/files_sharing/src/services/ConfigService.js
+++ b/apps/files_sharing/src/services/ConfigService.js
@@ -32,6 +32,17 @@ export default class Config {
}
/**
+ * Get default share permissions, if any
+ *
+ * @return {boolean}
+ * @readonly
+ * @memberof Config
+ */
+ get defaultPermissions() {
+ return this._shareConfig.defaultPermissions
+ }
+
+ /**
* Is public upload allowed on link shares ?
*
* @return {boolean}
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index 8893ee984a3..ef7f4964a84 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -16,8 +16,7 @@
</span>
</div>
<div class="sharingTabDetailsView__wrapper">
- <div ref="quickPermissions"
- class="sharingTabDetailsView__quick-permissions">
+ <div ref="quickPermissions" class="sharingTabDetailsView__quick-permissions">
<div>
<NcCheckboxRadioSwitch :button-variant="true"
:checked.sync="sharingPermission"
@@ -743,7 +742,7 @@ export default {
}
},
- initializePermissions() {
+ handleShareType() {
if (this.share.share_type) {
this.share.type = this.share.share_type
}
@@ -752,23 +751,34 @@ export default {
if ('shareType' in this.share) {
this.share.type = this.share.shareType
}
+ },
+ handleDefaultPermissions() {
if (this.isNewShare) {
- if (this.isPublicShare) {
- this.sharingPermission = BUNDLED_PERMISSIONS.READ_ONLY.toString()
+ const defaultPermissions = this.config.defaultPermissions
+ if (defaultPermissions === BUNDLED_PERMISSIONS.READ_ONLY || defaultPermissions === BUNDLED_PERMISSIONS.ALL) {
+ this.sharingPermission = defaultPermissions.toString()
} else {
- this.sharingPermission = BUNDLED_PERMISSIONS.ALL.toString()
- }
-
- } else {
- if (this.hasCustomPermissions || this.share.setCustomPermissions) {
this.sharingPermission = 'custom'
+ this.share.permissions = defaultPermissions
this.advancedSectionAccordionExpanded = true
this.setCustomPermissions = true
- } else {
- this.sharingPermission = this.share.permissions.toString()
}
}
},
+ handleCustomPermissions() {
+ if (!this.isNewShare && (this.hasCustomPermissions || this.share.setCustomPermissions)) {
+ this.sharingPermission = 'custom'
+ this.advancedSectionAccordionExpanded = true
+ this.setCustomPermissions = true
+ } else {
+ this.sharingPermission = this.share.permissions.toString()
+ }
+ },
+ initializePermissions() {
+ this.handleShareType()
+ this.handleDefaultPermissions()
+ this.handleCustomPermissions()
+ },
async saveShare() {
const permissionsAndAttributes = ['permissions', 'attributes', 'note', 'expireDate']
const publicShareAttributes = ['label', 'password', 'hideDownload']