summaryrefslogtreecommitdiffstats
path: root/settings/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'settings/src/components')
-rw-r--r--settings/src/components/appNavigation.vue2
-rw-r--r--settings/src/components/appNavigation/navigationItem.vue38
-rw-r--r--settings/src/components/userList.vue8
-rw-r--r--settings/src/components/userList/userRow.vue33
4 files changed, 58 insertions, 23 deletions
diff --git a/settings/src/components/appNavigation.vue b/settings/src/components/appNavigation.vue
index 02858b4bb5b..a3ae2620a97 100644
--- a/settings/src/components/appNavigation.vue
+++ b/settings/src/components/appNavigation.vue
@@ -4,7 +4,7 @@
<button type="button" :id="menu.new.id" :class="menu.new.icon" @click="menu.new.action">{{menu.new.text}}</button>
</div>
<ul :id="menu.id">
- <navigation-item v-for="(item, key) in menu.items" :item="item" :key="key" />
+ <navigation-item v-for="item in menu.items" :item="item" :key="item.key" />
</ul>
<div id="app-settings">
<div id="app-settings-header">
diff --git a/settings/src/components/appNavigation/navigationItem.vue b/settings/src/components/appNavigation/navigationItem.vue
index ee748ee826e..80584517b99 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]">
+ <nav-element :id="item.id" v-bind="navElement(item)"
+ :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>
+ </nav-element>
</template>
<script>
@@ -89,7 +84,7 @@ export default {
data() {
return {
openedMenu: false
- }
+ };
},
methods: {
showMenu() {
@@ -106,12 +101,29 @@ export default {
cancelEdit() {
// remove the editing class
if (Array.isArray(this.item.classes))
- this.item.classes = this.item.classes.filter(item => item !== 'editing');
+ this.item.classes = this.item.classes.filter(
+ item => item !== 'editing'
+ );
+ },
+ // This is used to decide which outter element type to use
+ // li or router-link
+ navElement(item) {
+ if (item.href) {
+ return {
+ is: 'li'
+ };
+ }
+ return {
+ is: 'router-link',
+ tag: 'li',
+ to: item.router,
+ exact: true
+ };
}
},
mounted() {
// prevent click outside event with popupItem.
this.popupItem = this.$el;
- },
-}
+ }
+};
</script>
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue
index ec08992e6cc..f7aec953ecc 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,11 @@ export default {
}
return disabledUsers;
}
- return this.users.filter(user => user.enabled === true);
+ if (!settings.isAdmin) {
+ // We don't want subadmins to edit themselves
+ return this.users.filter(user => user.enabled !== false && user.id !== oc_current_user);
+ }
+ 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..67a2582fc11 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'"
@@ -314,18 +326,22 @@ export default {
},
/**
- * Create a new group
+ * Create a new group and add user to it
*
* @param {string} groups Group id
* @returns {Promise}
*/
createGroup(gid) {
this.loading = {groups:true, subadmins:true}
- this.$store.dispatch('addGroup', gid).then(() => {
- this.loading = {groups:false, subadmins:false};
- let userid = this.user.id;
- this.$store.dispatch('addUserGroup', {userid, gid});
- });
+ this.$store.dispatch('addGroup', gid)
+ .then(() => {
+ this.loading = {groups:false, subadmins:false};
+ let userid = this.user.id;
+ this.$store.dispatch('addUserGroup', {userid, gid});
+ })
+ .catch(() => {
+ this.loading = {groups:false, subadmins:false};
+ });
return this.$store.getters.getGroups[this.groups.length];
},
@@ -360,6 +376,9 @@ export default {
if (this.$route.params.selectedGroup === gid) {
this.$store.commit('deleteUser', userid);
}
+ })
+ .catch(() => {
+ this.loading.groups = false
});
},