Allow override of "create" permission for model index
This commit is contained in:
parent
a0a405f849
commit
720fc6182d
|
@ -35,7 +35,7 @@
|
|||
<slot></slot>
|
||||
|
||||
<div v-if="showButtons"
|
||||
class="buttons">
|
||||
class="buttons" style="margin-top: 1rem;">
|
||||
<b-button :type="getSaveButtonType()"
|
||||
:icon-left="getSaveButtonIcon()"
|
||||
:disabled="saveDisabled"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</nav>
|
||||
|
||||
<div class="buttons"
|
||||
v-if="allowCreate && hasModelPerm('create')">
|
||||
v-if="allowCreate && userCanCreate()">
|
||||
<b-button class="new-object"
|
||||
type="is-primary"
|
||||
tag="router-link"
|
||||
|
@ -66,6 +66,7 @@ export default {
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
createPermCheck: Function,
|
||||
paginated: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
@ -182,6 +183,13 @@ export default {
|
|||
return this.getModelSlug()
|
||||
},
|
||||
|
||||
userCanCreate() {
|
||||
if (this.createPermCheck) {
|
||||
return this.createPermCheck()
|
||||
}
|
||||
return this.hasModelPerm('create')
|
||||
},
|
||||
|
||||
hasModelPerm(perm) {
|
||||
|
||||
// do normal check, but first add prefix
|
||||
|
|
Loading…
Reference in a new issue