Sha256: a6d67bbbbfceb081b2f19f9c6e985df757c743a131f717683ede098affcb0657

Contents?: true

Size: 827 Bytes

Versions: 9

Compression:

Stored size: 827 Bytes

Contents

module Worthwhile
  module Ability
    extend ActiveSupport::Concern
    included do
      self.ability_logic += [:worthwhile_permissions]
    end

    def worthwhile_permissions
      
      unless current_user.new_record?
        can :create, Worthwhile::ClassifyConcern
        can :create, [Worthwhile::GenericFile, Worthwhile::LinkedResource]
      end

      if user_groups.include? 'admin'
       can [:discover, :show, :read, :edit, :update, :destroy], :all
      end

      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
      unless current_user.new_record?
        can :create, [Worthwhile.configuration.curation_concerns]
        can :create, Collection
      end
    end

  end
end


Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
worthwhile-0.1.2 worthwhile-models/app/models/concerns/worthwhile/ability.rb
worthwhile-models-0.1.2 app/models/concerns/worthwhile/ability.rb
worthwhile-0.1.1 worthwhile-models/app/models/concerns/worthwhile/ability.rb
worthwhile-models-0.1.1 app/models/concerns/worthwhile/ability.rb
worthwhile-0.1.0 worthwhile-models/app/models/concerns/worthwhile/ability.rb
worthwhile-models-0.1.0 app/models/concerns/worthwhile/ability.rb
worthwhile-0.0.3 app/models/concerns/worthwhile/ability.rb
worthwhile-0.0.2 app/models/concerns/worthwhile/ability.rb
worthwhile-0.0.1 app/models/concerns/worthwhile/ability.rb