Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable18] Allow to edit admin/own user in the user management #19882

Merged
merged 3 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/settings/css/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,7 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
#app-content.user-list-grid {
display: grid;
grid-column-gap: 20px;
grid-auto-rows: minmax(60px, max-content);

.row {
// TODO replace with css4 subgrid when available
Expand Down Expand Up @@ -1561,10 +1562,12 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
}

> div,
> .displayName > form,
> form {
grid-row: 1;
display: inline-flex;
color: var(--color-text-lighter);
flex-grow: 1;

> input:not(:focus):not(:active) {
border-color: transparent;
Expand All @@ -1591,6 +1594,7 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
&.mailAddress {
> input {
text-overflow: ellipsis;
flex-grow: 1;
}
}

Expand Down
4 changes: 2 additions & 2 deletions apps/settings/js/vue-0.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-0.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/settings/js/vue-4.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-4.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/settings/js/vue-5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-5.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/settings/js/vue-6.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-6.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/settings/js/vue-7.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-7.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/settings/js/vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/src/components/UserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export default {
}
if (!this.settings.isAdmin) {
// we don't want subadmins to edit themselves
return this.users.filter(user => user.enabled !== false && user.id !== OC.getCurrentUser().uid)
return this.users.filter(user => user.enabled !== false)
}
return this.users.filter(user => user.enabled !== false)
},
Expand Down
2 changes: 1 addition & 1 deletion apps/settings/src/components/UserList/UserRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
<div v-if="showConfig.showLastLogin" />

<div class="userActions">
<div v-if="OC.currentUser !== user.id && user.id !== 'admin' && !loading.all"
<div v-if="!loading.all"
class="toggleUserActions">
<Actions>
<ActionButton icon="icon-checkmark"
Expand Down
8 changes: 3 additions & 5 deletions apps/settings/src/components/UserList/UserRowSimple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>

<div class="userActions">
<div v-if="canEdit && !loading.all" class="toggleUserActions">
<div v-if="canEditUser(user) && !loading.all" class="toggleUserActions">
<Actions>
<ActionButton icon="icon-rename" @click="toggleEdit">
{{ t('settings', 'Edit User') }}
Expand All @@ -79,7 +79,6 @@
<script>
import { PopoverMenu, Actions, ActionButton } from 'nextcloud-vue'
import ClickOutside from 'vue-click-outside'
import { getCurrentUser } from '@nextcloud/auth'

import UserRowMixin from '../../mixins/UserRowMixin'
export default {
Expand Down Expand Up @@ -144,10 +143,9 @@ export default {
}
return t('settings', '{size} used', { size: OC.Util.humanFileSize(0) })
},
canEdit() {
return getCurrentUser().uid !== this.user.id && this.user.id !== 'admin'
canEditUser() {
return (user) => this.settings.isAdmin || user.id !== OC.getCurrentUser().uid
},

},
methods: {
hideMenu() {
Expand Down