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