Merge pull request #18284 from nextcloud/backport/18228/16

[stable 16] Fix removing groups that have a slash in the name
This commit is contained in:
Roeland Jago Douma 2019-12-09 08:25:38 +01:00 committed by GitHub
commit 436cb021f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 26 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -70,7 +70,7 @@ const mutations = {
state.orderBy = orderBy;
state.userCount = userCount;
state.groups = orderGroups(state.groups, state.orderBy);
},
addGroup(state, {gid, displayName}) {
try {
@ -191,7 +191,7 @@ const actions = {
/**
* Get all users with full details
*
*
* @param {Object} context
* @param {Object} options
* @param {int} options.offset List offset to request
@ -244,7 +244,7 @@ const actions = {
/**
* Get all users with full details
*
*
* @param {Object} context
* @param {Object} options
* @param {int} options.offset List offset to request
@ -266,7 +266,7 @@ const actions = {
/**
* Get all users with full details from a groupid
*
*
* @param {Object} context
* @param {Object} options
* @param {int} options.offset List offset to request
@ -278,7 +278,7 @@ const actions = {
.then((response) => context.commit('getUsersFromList', response.data.ocs.data.users))
.catch((error) => context.commit('API_FAILURE', error));
},
getPasswordPolicyMinLength(context) {
if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) {
@ -290,7 +290,7 @@ const actions = {
/**
* Add group
*
*
* @param {Object} context
* @param {string} gid Group id
* @returns {Promise}
@ -313,14 +313,14 @@ const actions = {
/**
* Remove group
*
*
* @param {Object} context
* @param {string} gid Group id
* @returns {Promise}
*/
removeGroup(context, gid) {
return api.requireAdmin().then((response) => {
return api.delete(OC.linkToOCS(`cloud/groups/${gid}`, 2))
return api.delete(OC.linkToOCS(`cloud/groups/${encodeURIComponent(gid)}`, 2))
.then((response) => context.commit('removeGroup', gid))
.catch((error) => {throw error;});
}).catch((error) => context.commit('API_FAILURE', { gid, error }));
@ -328,7 +328,7 @@ const actions = {
/**
* Add user to group
*
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
@ -345,7 +345,7 @@ const actions = {
/**
* Remove user from group
*
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
@ -361,13 +361,13 @@ const actions = {
context.commit('API_FAILURE', { userid, error });
// let's throw one more time to prevent
// the view from removing the user row on failure
throw error;
throw error;
});
},
/**
* Add user to group admin
*
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
@ -384,7 +384,7 @@ const actions = {
/**
* Remove user from group admin
*
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
@ -401,9 +401,9 @@ const actions = {
/**
* Delete a user
*
*
* @param {Object} context
* @param {string} userid User id
* @param {string} userid User id
* @returns {Promise}
*/
deleteUser(context, userid) {
@ -416,7 +416,7 @@ const actions = {
/**
* Add a user
*
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
@ -441,9 +441,9 @@ const actions = {
/**
* Get user data and commit addition
*
*
* @param {Object} context
* @param {string} userid User id
* @param {string} userid User id
* @returns {Promise}
*/
addUserData(context, userid) {
@ -454,8 +454,8 @@ const actions = {
}).catch((error) => context.commit('API_FAILURE', { userid, error }));
},
/** Enable or disable user
*
/** Enable or disable user
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
@ -473,8 +473,8 @@ const actions = {
/**
* Edit user data
*
* @param {Object} context
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
* @param {string} options.key User field to edit
@ -503,9 +503,9 @@ const actions = {
/**
* Send welcome mail
*
*
* @param {Object} context
* @param {string} userid User id
* @param {string} userid User id
* @returns {Promise}
*/
sendWelcomeMail(context, userid) {