summaryrefslogtreecommitdiffstats
path: root/settings/src
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-23 13:01:40 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-24 17:52:15 +0200
commitddd1c8bc8689017559f6d6af36898fb7ddb28adb (patch)
treebb5ae0a068641a67b9f43b2a133b11d9683f0bb8 /settings/src
parent55184158292d3b4d4835b3bdb724bb19edf88355 (diff)
downloadnextcloud-server-ddd1c8bc8689017559f6d6af36898fb7ddb28adb.tar.gz
nextcloud-server-ddd1c8bc8689017559f6d6af36898fb7ddb28adb.zip
Disabled fix since new users list
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src')
-rw-r--r--settings/src/components/appNavigation/navigationItem.vue13
-rw-r--r--settings/src/components/userList.vue4
-rw-r--r--settings/src/components/userList/userRow.vue14
-rw-r--r--settings/src/router.js1
-rw-r--r--settings/src/store/index.js6
-rw-r--r--settings/src/store/users.js27
-rw-r--r--settings/src/views/Users.vue12
7 files changed, 48 insertions, 29 deletions
diff --git a/settings/src/components/appNavigation/navigationItem.vue b/settings/src/components/appNavigation/navigationItem.vue
index ee748ee826e..1537aeb3fd0 100644
--- a/settings/src/components/appNavigation/navigationItem.vue
+++ b/settings/src/components/appNavigation/navigationItem.vue
@@ -1,21 +1,16 @@
<template>
- <li :id="item.id" :class="[{'icon-loading-small': item.loading, 'open': item.opened, 'collapsible': item.collapsible&&item.children&&item.children.length>0 }, item.classes]">
+ <router-link :to="item.router" tag="li" :id="item.id" exact
+ :class="[{'icon-loading-small': item.loading, 'open': item.opened, 'collapsible': item.collapsible&&item.children&&item.children.length>0 }, item.classes]">
<!-- Bullet -->
<div v-if="item.bullet" class="app-navigation-entry-bullet" :style="{ backgroundColor: item.bullet }"></div>
<!-- Main link -->
- <a v-if="item.href" :href="(item.href) ? item.href : '#' " @click="toggleCollapse" :class="item.icon" >
+ <a :href="(item.href) ? item.href : '#' " @click="toggleCollapse" :class="item.icon">
<img v-if="item.iconUrl" :alt="item.text" :src="item.iconUrl">
{{item.text}}
</a>
- <!-- Router link if specified. href OR router -->
- <router-link :to="item.router" v-else-if="item.router" :class="item.icon" >
- <img v-if="item.iconUrl" :alt="item.text" :src="item.iconUrl">
- {{item.text}}
- </router-link>
-
<!-- Popover, counter and button(s) -->
<div v-if="item.utils" class="app-navigation-entry-utils">
<ul>
@@ -69,7 +64,7 @@
<ul v-if="item.children">
<navigation-item v-for="(item, key) in item.children" :item="item" :key="key" />
</ul>
- </li>
+ </router-link>
</template>
<script>
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue
index ec08992e6cc..c7127706269 100644
--- a/settings/src/components/userList.vue
+++ b/settings/src/components/userList.vue
@@ -171,7 +171,7 @@ export default {
},
filteredUsers() {
if (this.selectedGroup === 'disabled') {
- let disabledUsers = this.users.filter(user => user.enabled !== true);
+ let disabledUsers = this.users.filter(user => user.enabled === false);
if (disabledUsers.length===0 && this.$refs.infiniteLoading && this.$refs.infiniteLoading.isComplete) {
// disabled group is empty, redirection to all users
this.$router.push({name: 'users'});
@@ -179,7 +179,7 @@ export default {
}
return disabledUsers;
}
- return this.users.filter(user => user.enabled === true);
+ return this.users.filter(user => user.enabled !== false);
},
groups() {
// data provided php side + remove the disabled group
diff --git a/settings/src/components/userList/userRow.vue b/settings/src/components/userList/userRow.vue
index da3f93ed2c8..bcdb4ba0042 100644
--- a/settings/src/components/userList/userRow.vue
+++ b/settings/src/components/userList/userRow.vue
@@ -1,5 +1,17 @@
<template>
- <div class="row" :class="{'disabled': loading.delete || loading.disable}">
+ <!-- Obfuscated user: Logged in user does not have permissions to see all of the data -->
+ <div class="row" v-if="Object.keys(user).length ===1">
+ <div class="avatar" :class="{'icon-loading-small': loading.delete || loading.disable}">
+ <img alt="" width="32" height="32" :src="generateAvatar(user.id, 32)"
+ :srcset="generateAvatar(user.id, 64)+' 2x, '+generateAvatar(user.id, 128)+' 4x'"
+ v-if="!loading.delete && !loading.disable">
+ </div>
+ <div class="name">{{user.id}}</div>
+ <div class="obfuscated">{{t('settings','You do not have permissions to see the details of this user')}}</div>
+ </div>
+
+ <!-- User full data -->
+ <div class="row" v-else :class="{'disabled': loading.delete || loading.disable}">
<div class="avatar" :class="{'icon-loading-small': loading.delete || loading.disable}">
<img alt="" width="32" height="32" :src="generateAvatar(user.id, 32)"
:srcset="generateAvatar(user.id, 64)+' 2x, '+generateAvatar(user.id, 128)+' 4x'"
diff --git a/settings/src/router.js b/settings/src/router.js
index 7eedb359b69..270949d542c 100644
--- a/settings/src/router.js
+++ b/settings/src/router.js
@@ -18,6 +18,7 @@ export default new Router({
// if index.php is in the url AND we got this far, then it's working:
// let's keep using index.php in the url
base: OC.generateUrl(''),
+ linkActiveClass: 'active',
routes: [
{
path: '/:index(index.php/)?settings/users',
diff --git a/settings/src/store/index.js b/settings/src/store/index.js
index 4332ece33e4..aa64b245396 100644
--- a/settings/src/store/index.js
+++ b/settings/src/store/index.js
@@ -10,7 +10,11 @@ const debug = process.env.NODE_ENV !== 'production';
const mutations = {
API_FAILURE(state, error) {
- let message = error.error.response.data.ocs.meta.message;
+ try {
+ let message = error.error.response.data.ocs.meta.message;
+ } catch(e) {
+ let message = error;
+ }
OC.Notification.showHtml(t('settings','An error occured during the request. Unable to proceed.')+'<br>'+message, {timeout: 7});
console.log(state, error);
}
diff --git a/settings/src/store/users.js b/settings/src/store/users.js
index dc8b9fe1cb8..63a1568e048 100644
--- a/settings/src/store/users.js
+++ b/settings/src/store/users.js
@@ -12,6 +12,15 @@ const orderGroups = function(groups, orderBy) {
}
};
+const defaults = {
+ group: {
+ id: '',
+ name: '',
+ usercount: 0,
+ disabled: 0
+ }
+}
+
const state = {
users: [],
groups: [],
@@ -33,18 +42,20 @@ const mutations = {
state.minPasswordLength = length!=='' ? length : 0;
},
initGroups(state, {groups, orderBy, userCount}) {
- state.groups = groups;
+ state.groups = groups.map(group => Object.assign({}, defaults.group, group));
state.orderBy = orderBy;
state.userCount = userCount;
state.groups = orderGroups(state.groups, state.orderBy);
+
},
addGroup(state, gid) {
try {
- state.groups.push({
+ // extend group to default values
+ let group = Object.assign({}, defaults.group, {
id: gid,
- name: gid,
- usercount: 0 // user will be added after the creation
+ name: gid
});
+ state.groups.push(group);
state.groups = orderGroups(state.groups, state.orderBy);
} catch (e) {
console.log('Can\'t create group', e);
@@ -90,11 +101,15 @@ const mutations = {
state.users.push(response.data.ocs.data);
},
enableDisableUser(state, { userid, enabled }) {
- state.users.find(user => user.id == userid).enabled = enabled;
+ let user = state.users.find(user => user.id == userid);
+ user.enabled = enabled;
// increment or not
state.groups.find(group => group.id == 'disabled').usercount += enabled ? -1 : 1;
state.userCount += enabled ? 1 : -1;
- console.log(enabled);
+ user.groups.forEach(group => {
+ // Increment disabled count
+ state.groups.find(groupSearch => groupSearch.id == group).disabled += enabled ? -1 : 1;
+ });
},
setUserData(state, { userid, key, value }) {
if (key === 'quota') {
diff --git a/settings/src/views/Users.vue b/settings/src/views/Users.vue
index 0d298fd1ca3..67b960cba5f 100644
--- a/settings/src/views/Users.vue
+++ b/settings/src/views/Users.vue
@@ -238,8 +238,8 @@ export default {
name: 'group',
params: {selectedGroup: group.id}
};
- item.text = group.name; // group name
- item.utils = {counter: group.usercount}; // users count
+ item.text = group.name; // group name
+ item.utils = {counter: group.usercount - group.disabled}; // users count
if (item.id !== 'admin' && item.id !== 'disabled' && this.settings.isAdmin) {
// add delete button on real groups
@@ -276,14 +276,6 @@ export default {
utils: {counter: this.userCount}
});
- // Set current group as active
- let activeGroup = groups.findIndex(group => group.id === this.selectedGroup);
- if (activeGroup >= 0) {
- groups[activeGroup].classes.push('active');
- } else {
- groups[0].classes.push('active');
- }
-
// Return
return {
id: 'usergrouplist',