using ReviseOperation with backpack Laravel

28 views Asked by At

i've implemented the ReviseOperation for Backpack addon in my backpack app but I got stuck at using the revisions with permissions.

I would like the revisions to only be available to the users that have the revise-operation permission.

for the other operations i use something like:

if (!backpack_user()->can('clients_access')) {
            CRUD::denyAccess('list');
}

if (!backpack_user()->can('clients_create')) {
            CRUD::denyAccess('create');
}

and so on.

but how can I do the same with revisions?

in my CrduController I've added:

use \Backpack\ReviseOperation\ReviseOperation;

and in my model I've added:

use \Venturecraft\Revisionable\RevisionableTrait;
1

There are 1 answers

0
saycookie On

i found the answer. If anyone needs this, just add the permission "revise" and this check:

if (!backpack_user()->can('revise')) {
            CRUD::denyAccess('revise');
}

to your Crud Controller in the setup function