Consolidate some perm check logic

This commit is contained in:
Lance Edgar 2020-02-23 21:09:04 -06:00
parent d887345138
commit 24667ead2a

View file

@ -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) {