Skip to content

Commit

Permalink
Merge pull request #3765 from nextcloud/backport/3758/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: Uncheck group limit in admin settings
  • Loading branch information
elzody authored Jun 17, 2024
2 parents 0a94e52 + 4db43fa commit 6c4eddc
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,25 +242,25 @@
:disabled="updating"
@input="updateOoxml" />

<SettingsCheckbox :value="settings.use_groups !== null"
<SettingsCheckbox :value="settings.use_groups?.length > 0"
:label="t('richdocuments', 'Restrict usage to specific groups')"
:hint="t('richdocuments', '{productName} is enabled for all users by default. When this setting is active, only members of the specified groups can use it.', { productName })"
:disabled="updating"
@input="updateUseGroups">
<SettingsSelectGroup v-if="settings.use_groups !== null"
<SettingsSelectGroup v-if="uiVisible.use_groups || settings.use_groups?.length > 0"
v-model="settings.use_groups"
:label="t('richdocuments', 'Select groups')"
class="option-inline"
:disabled="updating"
@input="updateUseGroups" />
</SettingsCheckbox>

<SettingsCheckbox :value="settings.edit_groups !== null"
<SettingsCheckbox :value="settings.edit_groups?.length > 0"
:label="t('richdocuments', 'Restrict edit to specific groups')"
:hint="t('richdocuments', 'All users can edit documents with {productName} by default. When this setting is active, only the members of the specified groups can edit, whereas the others can only view documents.', { productName })"
:disabled="updating"
@input="updateEditGroups">
<SettingsSelectGroup v-if="settings.edit_groups !== null"
<SettingsSelectGroup v-if="uiVisible.edit_groups || settings.edit_groups?.length > 0"
v-model="settings.edit_groups"
:label="t('richdocuments', 'Select groups')"
class="option-inline"
Expand Down Expand Up @@ -483,6 +483,8 @@ export default {
uiVisible: {
canonical_webroot: false,
external_apps: false,
use_groups: false,
edit_groups: false,
},
settings: {
demoUrl: null,
Expand Down Expand Up @@ -649,23 +651,27 @@ export default {
})
},
async updateUseGroups(enabled) {
if (enabled) {
this.settings.use_groups = enabled === true ? [] : enabled
} else {
this.settings.use_groups = null
if (typeof enabled === 'boolean') {
this.settings.use_groups = (enabled) ? [] : null
this.uiVisible.use_groups = Boolean(this.settings.use_groups)
} else if (enabled.length > 0) {
this.settings.use_groups = enabled
}

await this.updateSettings({
use_groups: this.settings.use_groups !== null ? this.settings.use_groups.join('|') : '',
use_groups: this.settings.use_groups?.join('|') ?? '',
})
},
async updateEditGroups(enabled) {
if (enabled) {
this.settings.edit_groups = enabled === true ? [] : enabled
} else {
this.settings.edit_groups = null
if (typeof enabled === 'boolean') {
this.settings.edit_groups = (enabled) ? [] : null
this.uiVisible.edit_groups = Boolean(this.settings.edit_groups)
} else if (enabled.length > 0) {
this.settings.edit_groups = enabled
}

await this.updateSettings({
edit_groups: this.settings.edit_groups !== null ? this.settings.edit_groups.join('|') : '',
edit_groups: this.settings.edit_groups?.join('|') ?? '',
})
},
async updateCanonicalWebroot(canonicalWebroot) {
Expand Down

0 comments on commit 6c4eddc

Please sign in to comment.