Hide UI elements if the user does not have the right to use them (#211)
Hide Team UI elements if the user does not have the rights to use them Fix replacing the right saved in the model when updating Hide UI-Elements on task if the user does not have the rights to use them Hide UI-Elements on gantt if the user does not have the rights to use them Hide UI-Elements on kanban if the user does not have rights to use them Fix canWrite condition Hide list components if the user has no right to write to the list Add max right to model Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/211
This commit is contained in:
@ -61,7 +61,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card is-fullwidth">
|
||||
|
||||
<header class="card-header">
|
||||
<p class="card-header-title">
|
||||
Team Members
|
||||
@ -188,6 +187,7 @@
|
||||
import UserService from '../../services/user'
|
||||
import LoadingComponent from '../../components/misc/loading'
|
||||
import ErrorComponent from '../../components/misc/error'
|
||||
import Rights from '../../models/rights.json'
|
||||
|
||||
export default {
|
||||
name: 'EditTeam',
|
||||
@ -201,7 +201,6 @@
|
||||
|
||||
showDeleteModal: false,
|
||||
showUserDeleteModal: false,
|
||||
userIsAdmin: false,
|
||||
|
||||
newMember: UserModel,
|
||||
foundUsers: [],
|
||||
@ -234,9 +233,14 @@
|
||||
// call again the method if the route changes
|
||||
'$route': 'loadTeam',
|
||||
},
|
||||
computed: mapState({
|
||||
userInfo: state => state.auth.info,
|
||||
}),
|
||||
computed: {
|
||||
userIsAdmin() {
|
||||
return this.team && this.team.maxRight && this.team.maxRight > Rights.READ
|
||||
},
|
||||
...mapState({
|
||||
userInfo: state => state.auth.info,
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
loadTeam() {
|
||||
this.team = new TeamModel({id: this.teamId})
|
||||
@ -244,13 +248,6 @@
|
||||
.then(response => {
|
||||
this.$set(this, 'team', response)
|
||||
this.setTitle(`Edit Team ${this.team.name}`)
|
||||
let members = response.members
|
||||
for (const m in members) {
|
||||
members[m].teamId = this.teamId
|
||||
if (members[m].id === this.userInfo.id && members[m].admin) {
|
||||
this.userIsAdmin = true
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
@ -313,7 +310,7 @@
|
||||
member.admin = !member.admin
|
||||
this.teamMemberService.update(member)
|
||||
.then(r => {
|
||||
for(const tm in this.team.members) {
|
||||
for (const tm in this.team.members) {
|
||||
if (this.team.members[tm].id === member.id) {
|
||||
this.$set(this.team.members[tm], 'admin', r.admin)
|
||||
break
|
||||
@ -357,5 +354,9 @@
|
||||
|
||||
.team-members {
|
||||
padding: 0;
|
||||
|
||||
.table {
|
||||
border-top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user