-1

I have an active admin code running which is as below

ActiveAdmin.register UserProcess, as: 'Summary' do
....
end

active_admin.rb -

config.authorization_adapter = ActiveAdmin::CanCanAdapter
config.cancan_ability_class = "Ability"
config.on_unauthorized_access = :access_denied

I want to block user from accessing this Summary page without actually blocking his access from UserProcess.

adding cannot :manage, UserProcess works for the page but then it also does not allow the user to access him other pages.

Also my namespace is :actadmin

Please let me know the correct thing to write in Ability class

Tanay Sharma
  • 1,098
  • 10
  • 29
Vikas Verma
  • 84
  • 1
  • 6

1 Answers1

0

I solved similar thing by creating a custom page and apply cancan ability on that page.Otherwise ability was applied on resource.

ActiveAdmin.register_page "Summary" do
 menu parent: "UserProcess", label: "Summary"
  content title: "Summary" do
   .......
   .......
  end
end

and apply ability on it this way:

class Ability
 include CanCan::Ability
  def initialize(users)
   can :manage UserProcess
   cannot :manage, ActiveAdmin::Page, name: "Summary"
  end
end

If you found by the time another cleaner solution,please edit me!