Sha256: 3e6c5b5afe031a781163b89397478382ddf99daa23571d36e86abf1f38804ffb
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module CurationConcerns module Ability extend ActiveSupport::Concern included do self.ability_logic += [:curation_concerns_permissions, :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 admin_permissions can [:create, :discover, :show, :read, :edit, :update, :destroy], :all end def admin? user_groups.include? 'admin' end def add_to_collection return if current_user.new_record? can :collect, :all 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 if current_user.new_record? can :create, [::FileSet, ::Collection] can :create, [CurationConcerns.config.curation_concerns] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
curation_concerns-models-0.3.0 | app/models/concerns/curation_concerns/ability.rb |