mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Various fixes
* Fixed subadmin group management * Fixed pass policy prop retrieving * Fixed fields subadmins were not supposed to see Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
bcffbab6f8
commit
e23e28b3cc
9 changed files with 45 additions and 23 deletions
|
|
@ -241,6 +241,7 @@ class UsersController extends Controller {
|
|||
$serverData['groups'] = array_merge_recursive($adminGroup, [$disabledUsersGroup], $groups);
|
||||
$serverData['subadmingroups'] = $groups;
|
||||
// Various data
|
||||
$serverData['isAdmin'] = $this->isAdmin;
|
||||
$serverData['subadmins'] = $subAdmins;
|
||||
$serverData['sortGroups'] = $sortGroupsBy;
|
||||
$serverData['quotaPreset'] = $quotaPreset;
|
||||
|
|
|
|||
|
|
@ -1331,14 +1331,23 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
|
|||
&.sticky {
|
||||
box-shadow: 0 -2px 10px 1px $color-box-shadow;
|
||||
}
|
||||
/* fake input for groups validation */
|
||||
input#newgroups {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 80% !important;
|
||||
margin: 0 10%;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
// separate prop to set initial value to top:0
|
||||
&#new-user {
|
||||
top: $grid-row-height;
|
||||
}
|
||||
&#grid-header {
|
||||
color: nc-lighten($color-main-text, 60%);
|
||||
z-index: 60; /* above new-user */
|
||||
}
|
||||
&#new-user {
|
||||
top: $grid-row-height;
|
||||
}
|
||||
&:hover {
|
||||
input:not([type='submit']):not(:focus):not(:active) {
|
||||
border-color: nc-darken($color-main-background, 14%) !important;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -8,7 +8,7 @@
|
|||
<div id="headerAddress" class="mailAddress">{{ t('settings', 'Email') }}</div>
|
||||
<div id="headerGroups" class="groups">{{ t('settings', 'Groups') }}</div>
|
||||
<div id="headerSubAdmins" class="subadmins"
|
||||
v-if="subAdminsGroups.length>0">{{ t('settings', 'Group admin for') }}</div>
|
||||
v-if="subAdminsGroups.length>0 && settings.isAdmin">{{ t('settings', 'Group admin for') }}</div>
|
||||
<div id="headerQuota" class="quota">{{ t('settings', 'Quota') }}</div>
|
||||
<div id="headerLanguages" class="languages"
|
||||
v-if="showConfig.showLanguages">{{ t('settings', 'Languages') }}</div>
|
||||
|
|
@ -50,19 +50,26 @@
|
|||
autocomplete="off" autocapitalize="none" autocorrect="off">
|
||||
</div>
|
||||
<div class="groups">
|
||||
<!-- hidden input trick for vanilla html5 form validation -->
|
||||
<input type="text" :value="newUser.groups" v-if="!settings.isAdmin"
|
||||
tabindex="-1" id="newgroups" :required="!settings.isAdmin" />
|
||||
<multiselect :options="groups" v-model="newUser.groups"
|
||||
:placeholder="t('settings', 'Add user in group')"
|
||||
label="name" track-by="id" class="multiselect-vue"
|
||||
:multiple="true" :close-on-select="false">
|
||||
<span slot="noResult">{{t('settings','No result')}}</span>
|
||||
:multiple="true" :close-on-select="false"
|
||||
:allowEmpty="settings.isAdmin">
|
||||
<!-- If user is not admin, he is a subadmin.
|
||||
Subadmins can't create users outside their groups
|
||||
Therefore, empty select is forbidden -->
|
||||
<span slot="noResult">{{t('settings', 'No results')}}</span>
|
||||
</multiselect>
|
||||
</div>
|
||||
<div class="subadmins" v-if="subAdminsGroups.length>0">
|
||||
<div class="subadmins" v-if="subAdminsGroups.length>0 && settings.isAdmin">
|
||||
<multiselect :options="subAdminsGroups" v-model="newUser.subAdminsGroups"
|
||||
:placeholder="t('settings', 'Set user as admin for')"
|
||||
label="name" track-by="id" class="multiselect-vue"
|
||||
:multiple="true" :close-on-select="false">
|
||||
<span slot="noResult">{{t('settings','No result')}}</span>
|
||||
<span slot="noResult">{{t('settings', 'No results')}}</span>
|
||||
</multiselect>
|
||||
</div>
|
||||
<div class="quota">
|
||||
|
|
@ -269,7 +276,8 @@ export default {
|
|||
subadmin: this.newUser.subAdminsGroups.map(group => group.id),
|
||||
quota: this.newUser.quota.id,
|
||||
language: this.newUser.language.code,
|
||||
}).then(() => this.resetForm());
|
||||
}).then(() => this.resetForm())
|
||||
.catch(() => this.loading = false);
|
||||
},
|
||||
setNewUserDefaultGroup(value) {
|
||||
if (value && value.length > 0) {
|
||||
|
|
|
|||
|
|
@ -34,18 +34,19 @@
|
|||
tag-placeholder="create" :placeholder="t('settings', 'Add user in group')"
|
||||
label="name" track-by="id" class="multiselect-vue"
|
||||
:limit="2" :limitText="limitGroups"
|
||||
:multiple="true" :taggable="true" :closeOnSelect="false"
|
||||
:multiple="true" :taggable="settings.isAdmin" :closeOnSelect="false"
|
||||
@tag="createGroup" @select="addUserGroup" @remove="removeUserGroup">
|
||||
<span slot="noResult">{{t('settings', 'No results')}}</span>
|
||||
</multiselect>
|
||||
</div>
|
||||
<div class="subadmins" v-if="subAdminsGroups.length>0" :class="{'icon-loading-small': loading.subadmins}">
|
||||
<div class="subadmins" v-if="subAdminsGroups.length>0 && settings.isAdmin" :class="{'icon-loading-small': loading.subadmins}">
|
||||
<multiselect :value="userSubAdminsGroups" :options="subAdminsGroups" :disabled="loading.subadmins||loading.all"
|
||||
:placeholder="t('settings', 'Set user as admin for')"
|
||||
label="name" track-by="id" class="multiselect-vue"
|
||||
:limit="2" :limitText="limitGroups"
|
||||
:multiple="true" :closeOnSelect="false"
|
||||
@select="addUserSubAdmin" @remove="removeUserSubAdmin">
|
||||
<span slot="noResult">{{t('settings','No result')}}</span>
|
||||
<span slot="noResult">{{t('settings', 'No results')}}</span>
|
||||
</multiselect>
|
||||
</div>
|
||||
<div class="quota" :class="{'icon-loading-small': loading.quota}">
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ const debug = process.env.NODE_ENV !== 'production';
|
|||
|
||||
const mutations = {
|
||||
API_FAILURE(state, error) {
|
||||
console.log(state, error);
|
||||
OC.Notification.showTemporary(t('settings','An error occured during the request. Unable to proceed.'));
|
||||
// throw to raise exception of the promise and allow a `.then` in the Vue methods
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -213,9 +213,11 @@ const actions = {
|
|||
|
||||
|
||||
getPasswordPolicyMinLength(context) {
|
||||
return api.get(OC.linkToOCS('apps/provisioning_api/api/v1/config/apps/password_policy/minLength', 2))
|
||||
.then((response) => context.commit('setPasswordPolicyMinLength', response.data.ocs.data.data))
|
||||
.catch((error) => context.commit('API_FAILURE', error));
|
||||
if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) {
|
||||
context.commit('setPasswordPolicyMinLength', oc_capabilities.password_policy.minLength);
|
||||
return oc_capabilities.password_policy.minLength;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -344,12 +346,12 @@ const actions = {
|
|||
* @param {string} options.quota User email
|
||||
* @returns {Promise}
|
||||
*/
|
||||
addUser({context, dispatch}, { userid, password, email, groups, subadmin, quota, language }) {
|
||||
addUser({commit, dispatch}, { userid, password, email, groups, subadmin, quota, language }) {
|
||||
return api.requireAdmin().then((response) => {
|
||||
return api.post(OC.linkToOCS(`cloud/users`, 2), { userid, password, email, groups, subadmin, quota, language })
|
||||
.then((response) => dispatch('addUserData', userid))
|
||||
.catch((error) => {throw error;});
|
||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }));
|
||||
}).catch((error) => commit('API_FAILURE', { userid, error }));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ export default {
|
|||
item.text = group.name; // group name
|
||||
item.utils = {counter: group.usercount}; // users count
|
||||
|
||||
if (item.id !== 'admin' && item.id !== 'disabled') {
|
||||
if (item.id !== 'admin' && item.id !== 'disabled' && this.settings.isAdmin) {
|
||||
// add delete button on real groups
|
||||
let self = this;
|
||||
item.utils.actions = [{
|
||||
|
|
|
|||
Loading…
Reference in a new issue