Module: CurationConcerns::Ability
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/curation_concerns/ability.rb
Instance Method Summary collapse
- #add_to_collection ⇒ Object
-
#admin? ⇒ Boolean
Override this method in your ability model if you use a different group or other logic to designate an administrator.
- #admin_permissions ⇒ Object
- #curation_concerns_permissions ⇒ Object
-
#everyone_can_create_curation_concerns ⇒ Object
Add this to your ability_logic if you want all logged in users to be able to submit content.
- #operation_abilities ⇒ Object
- #registered_user? ⇒ Boolean
Instance Method Details
#add_to_collection ⇒ Object
47 48 49 50 |
# File 'app/models/concerns/curation_concerns/ability.rb', line 47 def add_to_collection return if current_user.new_record? can :collect, :all end |
#admin? ⇒ Boolean
Override this method in your ability model if you use a different group or other logic to designate an administrator.
43 44 45 |
# File 'app/models/concerns/curation_concerns/ability.rb', line 43 def admin? user_groups.include? 'admin' end |
#admin_permissions ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'app/models/concerns/curation_concerns/ability.rb', line 31 def can :read, :admin_dashboard alias_action :edit, to: :update alias_action :show, to: :read alias_action :discover, to: :read can :manage, curation_concerns_models can :manage, Sipity::WorkflowResponsibility end |
#curation_concerns_permissions ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/concerns/curation_concerns/ability.rb', line 10 def unless current_user.new_record? can :create, CurationConcerns::ClassifyConcern end # user can version if they can edit alias_action :versions, to: :update alias_action :file_manager, to: :update if admin? else cannot :index, Hydra::AccessControls::Embargo cannot :index, Hydra::AccessControls::Lease end end |
#everyone_can_create_curation_concerns ⇒ Object
Add this to your ability_logic if you want all logged in users to be able to submit content
58 59 60 61 |
# File 'app/models/concerns/curation_concerns/ability.rb', line 58 def everyone_can_create_curation_concerns return unless registered_user? can :create, curation_concerns_models end |
#operation_abilities ⇒ Object
27 28 29 |
# File 'app/models/concerns/curation_concerns/ability.rb', line 27 def operation_abilities can :read, Operation, user_id: current_user.id end |
#registered_user? ⇒ Boolean
52 53 54 |
# File 'app/models/concerns/curation_concerns/ability.rb', line 52 def registered_user? user_groups.include? 'registered' end |