trestle icon indicating copy to clipboard operation
trestle copied to clipboard

remove_action with conditions

Open shenhf opened this issue 6 years ago • 3 comments

Request for

remove_action :new, unless: -> {current_user.admin?}

or

remove_action :new unless current_user.admin?

raise

undefined local variable or method `current_user' for #<Trestle::Resource::Builder:0x00007f9206837be8>

Thanks.

shenhf avatar Feb 10 '19 01:02 shenhf

Any updates regarding this issue? I want to exclude some pages for different user roles?

michaelfahmy avatar May 23 '21 13:05 michaelfahmy

@michaelfahmy Check out the authorization branch of the trestle-auth gem at https://github.com/TrestleAdmin/trestle-auth/tree/authorization#authorization. This is fairly close to being ready to merge into master and will be the proper way to handle this situation.

spohlenz avatar May 24 '21 11:05 spohlenz

@spohlenz Any plan to merge the authorization branch into main? Or is it safe to use the authorization branch instead of main?

laysakura avatar Jul 17 '23 22:07 laysakura