trestle
trestle copied to clipboard
remove_action with conditions
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.
Any updates regarding this issue? I want to exclude some pages for different user roles?
@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 Any plan to merge the authorization
branch into main? Or is it safe to use the authorization
branch instead of main?