[stable 17] Fix removing groups that have a slash in the name (#18257)

[stable 17] Fix removing groups that have a slash in the name
This commit is contained in:
John Molakvoæ 2019-12-07 09:46:28 +01:00 committed by GitHub
commit 2668ca73f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 27 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.getCapabilities().password_policy && OC.getCapabilities().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
@ -415,9 +415,9 @@ const actions = {
/**
* Delete a user
*
*
* @param {Object} context
* @param {string} userid User id
* @param {string} userid User id
* @returns {Promise}
*/
deleteUser(context, userid) {
@ -430,7 +430,7 @@ const actions = {
/**
* Add a user
*
*
* @param {Object} context
* @param {Object} options
* @param {string} options.userid User id
@ -455,9 +455,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) {
@ -468,8 +468,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
@ -487,8 +487,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
@ -517,9 +517,9 @@ const actions = {
/**
* Send welcome mail
*
*
* @param {Object} context
* @param {string} userid User id
* @param {string} userid User id
* @returns {Promise}
*/
sendWelcomeMail(context, userid) {