Fix removing groups that have a slash in the name

Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
Gary Kim 2019-12-08 21:19:52 +08:00
parent 726a5101ac
commit 9f332e53ab
No known key found for this signature in database
GPG key ID: 9349B59FB54594AC
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) {