Consolidate some perm check logic
This commit is contained in:
parent
d887345138
commit
24667ead2a
|
@ -168,22 +168,11 @@ export default {
|
|||
return this.getModelSlug()
|
||||
},
|
||||
|
||||
hasPerm(perm) {
|
||||
|
||||
// if user is root then assume permission
|
||||
if (this.$store.state.user && this.$store.state.user.is_root) {
|
||||
return true
|
||||
}
|
||||
|
||||
// otherwise do true perm check for user
|
||||
return this.$store.state.permissions.includes(perm)
|
||||
},
|
||||
|
||||
hasModelPerm(perm) {
|
||||
|
||||
// do normal check, but first add prefix
|
||||
let prefix = this.getModelPermissionPrefix()
|
||||
return this.hasPerm(prefix + '.' + perm)
|
||||
return this.$hasPerm(prefix + '.' + perm)
|
||||
},
|
||||
|
||||
renderLabel(obj) {
|
||||
|
|
Loading…
Reference in a new issue