Sha256: 2bff985db6f33265c1d670d5b37352702ad1d4c6e7700ddf4400aac874cc2b11
Contents?: true
Size: 1.66 KB
Versions: 30
Compression:
Stored size: 1.66 KB
Contents
module CurationConcerns module Ability extend ActiveSupport::Concern included do self.ability_logic += [:curation_concerns_permissions, :operation_abilities, :add_to_collection] end def curation_concerns_permissions unless current_user.new_record? can :create, CurationConcerns::ClassifyConcern end # user can version if they can edit alias_action :versions, to: :update if admin? admin_permissions else cannot :index, Hydra::AccessControls::Embargo cannot :index, Hydra::AccessControls::Lease end end def operation_abilities can :read, Operation, user_id: current_user.id end def admin_permissions alias_action :edit, to: :update alias_action :show, to: :read alias_action :discover, to: :read can :manage, curation_concerns_models end # Override this method in your ability model if you use a different group # or other logic to designate an administrator. def admin? user_groups.include? 'admin' end def add_to_collection return if current_user.new_record? can :collect, :all end def registered_user? user_groups.include? 'registered' end # Add this to your ability_logic if you want all logged in users to be able # to submit content def everyone_can_create_curation_concerns return unless registered_user? can :create, curation_concerns_models end private def curation_concerns_models [::FileSet, ::Collection] + CurationConcerns.config.curation_concerns end end end
Version data entries
30 entries across 30 versions & 1 rubygems