I have a user model with rolify gem. In my app I am using active_admin as admin interface. Have can I restrict active_admin to admin users only?
Try putting your rolify role check in the same place as mentioned in the Active Admin documentation's example for getting access to the current user :
class OnlyAdmins < ActiveAdmin::AuthorizationAdapter
def authorized?(action, subject = nil)
# Do rolify check here
user.has_role? :admin
end
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.