Samvera uses cancancan to do authorization of many actions.
Cancancan generates app/models/ability.rb into your application and then hydra-head’s generator and later Hyrax’s generator each adds a couple of lines so that the class looks like this:
self.ability_logic += [:everyone_can_create_curation_concerns]
# Define any customized permissions here.
# Limits deleting objects to a the admin user
# if current_user.admin?
# can [:destroy], ActiveFedora::Base
# Limits creating new objects to a specific group
# if user_groups.include? 'special_group'
# can [:create], ActiveFedora::Base
You don’t need to make any changes to this class as the included behavior provides all that you need to get started. However, if you are integrating an group system other than the default (See Hydra::RoleMapper), then you may want to change who has the admin role.
You can do this by overriding the admin? method on the Ability class like this:
In-depth tutorials and explanations of the structure