summaryrefslogtreecommitdiffstats
path: root/settings/src/store/users.js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-04-15 16:00:44 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-16 09:50:22 +0200
commitff2c23d9e2230960c1712318f452592079b5d2e8 (patch)
tree03a9025013983de086f1230bcc70d90c1343167e /settings/src/store/users.js
parent45f1efe95391b09fbf3e4880eb4000f25a529ce3 (diff)
downloadnextcloud-server-ff2c23d9e2230960c1712318f452592079b5d2e8.tar.gz
nextcloud-server-ff2c23d9e2230960c1712318f452592079b5d2e8.zip
Added default quota selector
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src/store/users.js')
-rw-r--r--settings/src/store/users.js44
1 files changed, 25 insertions, 19 deletions
diff --git a/settings/src/store/users.js b/settings/src/store/users.js
index 6523c85037a..0e0632fff31 100644
--- a/settings/src/store/users.js
+++ b/settings/src/store/users.js
@@ -38,11 +38,11 @@ const mutations = {
state.userCount = userCount;
state.groups = orderGroups(state.groups, state.orderBy);
},
- addGroup(state, groupid) {
+ addGroup(state, gid) {
try {
state.groups.push({
- id: groupid,
- name: groupid,
+ id: gid,
+ name: gid,
usercount: 0 // user will be added after the creation
});
state.groups = orderGroups(state.groups, state.orderBy);
@@ -50,6 +50,12 @@ const mutations = {
console.log('Can\'t create group', e);
}
},
+ removeGroup(state, gid) {
+ let groupIndex = state.groups.findIndex(groupSearch => groupSearch.id == gid);
+ if (groupIndex >= 0) {
+ state.groups.splice(groupIndex, 1);
+ }
+ },
addUserGroup(state, { userid, gid }) {
// this should not be needed as it would means the user contains a group
// the server database doesn't have.
@@ -144,7 +150,7 @@ const actions = {
* @param {int} options.limit List number to return from offset
* @param {string} options.search Search amongst users
* @param {string} options.group Get users from group
- * @returns Promise
+ * @returns {Promise}
*/
getUsers(context, { offset, limit, search, group }) {
search = typeof search === 'string' ? search : '';
@@ -179,7 +185,7 @@ const actions = {
* @param {Object} options
* @param {int} options.offset List offset to request
* @param {int} options.limit List number to return from offset
- * @returns Promise
+ * @returns {Promise}
*/
getUsersFromList(context, { offset, limit, search }) {
search = typeof search === 'string' ? search : '';
@@ -201,7 +207,7 @@ const actions = {
* @param {Object} options
* @param {int} options.offset List offset to request
* @param {int} options.limit List number to return from offset
- * @returns Promise
+ * @returns {Promise}
*/
getUsersFromGroup(context, { groupid, offset, limit }) {
return api.get(OC.linkToOCS(`cloud/users/${groupid}/details?offset=${offset}&limit=${limit}`, 2))
@@ -221,7 +227,7 @@ const actions = {
*
* @param {Object} context
* @param {string} gid Group id
- * @returns Promise
+ * @returns {Promise}
*/
addGroup(context, gid) {
return api.requireAdmin().then((response) => {
@@ -236,14 +242,14 @@ const actions = {
*
* @param {Object} context
* @param {string} gid Group id
- * @returns Promise
+ * @returns {Promise}
*/
removeGroup(context, gid) {
return api.requireAdmin().then((response) => {
- return api.post(OC.linkToOCS(`cloud/groups`, 2), {groupid: gid})
+ return api.delete(OC.linkToOCS(`cloud/groups/${gid}`, 2))
.then((response) => context.commit('removeGroup', gid))
.catch((error) => {throw error;});
- }).catch((error) => context.commit('API_FAILURE', { userid, error }));
+ }).catch((error) => context.commit('API_FAILURE', { gid, error }));
},
/**
@@ -253,7 +259,7 @@ const actions = {
* @param {Object} options
* @param {string} options.userid User id
* @param {string} options.gid Group id
- * @returns Promise
+ * @returns {Promise}
*/
addUserGroup(context, { userid, gid }) {
return api.requireAdmin().then((response) => {
@@ -270,7 +276,7 @@ const actions = {
* @param {Object} options
* @param {string} options.userid User id
* @param {string} options.gid Group id
- * @returns Promise
+ * @returns {Promise}
*/
removeUserGroup(context, { userid, gid }) {
return api.requireAdmin().then((response) => {
@@ -287,7 +293,7 @@ const actions = {
* @param {Object} options
* @param {string} options.userid User id
* @param {string} options.gid Group id
- * @returns Promise
+ * @returns {Promise}
*/
addUserSubAdmin(context, { userid, gid }) {
return api.requireAdmin().then((response) => {
@@ -304,7 +310,7 @@ const actions = {
* @param {Object} options
* @param {string} options.userid User id
* @param {string} options.gid Group id
- * @returns Promise
+ * @returns {Promise}
*/
removeUserSubAdmin(context, { userid, gid }) {
return api.requireAdmin().then((response) => {
@@ -319,7 +325,7 @@ const actions = {
*
* @param {Object} context
* @param {string} userid User id
- * @returns Promise
+ * @returns {Promise}
*/
deleteUser(context, { userid }) {
return api.requireAdmin().then((response) => {
@@ -340,7 +346,7 @@ const actions = {
* @param {string} options.groups User groups
* @param {string} options.subadmin User subadmin groups
* @param {string} options.quota User email
- * @returns Promise
+ * @returns {Promise}
*/
addUser({context, dispatch}, { userid, password, email, groups, subadmin, quota, language }) {
return api.requireAdmin().then((response) => {
@@ -355,7 +361,7 @@ const actions = {
*
* @param {Object} context
* @param {string} userid User id
- * @returns Promise
+ * @returns {Promise}
*/
addUserData(context, userid) {
return api.requireAdmin().then((response) => {
@@ -371,7 +377,7 @@ const actions = {
* @param {Object} options
* @param {string} options.userid User id
* @param {boolean} options.enabled User enablement status
- * @returns Promise
+ * @returns {Promise}
*/
enableDisableUser(context, { userid, enabled = true }) {
let userStatus = enabled ? 'enable' : 'disable';
@@ -390,7 +396,7 @@ const actions = {
* @param {string} options.userid User id
* @param {string} options.key User field to edit
* @param {string} options.value Value of the change
- * @returns Promise
+ * @returns {Promise}
*/
setUserData(context, { userid, key, value }) {
let allowedEmpty = ['email', 'displayname'];