Sha256: 8e7b558790ca8bd00bf724671a9b28ce0e1f385985b0f1cb38a45d73a077ee4e

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

class Ability
  include CanCan::Ability

  def initialize(member)
#    alias_action :index, :show, :update, :to => :manage_users
  member ||= Member.new
  	if member.has_role? :employee
	    can :invite, User
      can :index, Cancellation
      can :index, Task
      can :show, Cancellation
      can :index, Job
      can :update, Cancellation
      can :cancel, Cancellation
      can :index, Candidate
      can :trade, Candidate
      can :deny, Candidate

      can :create, Feedback

      can :manage, Message

      can :manage, Mailboxer::Conversation

      can :index, ShiftOff
      
      can :create, Organization
      can :index, Organization
      can :save_employees, Organization
      can :login_organization, Organization
      can :select_org_member, Organization

      can :published_schedules, Schedule
      can :export, Schedule
      can :overview, Schedule
      can :email_export, Schedule
      can :export_pdf, Schedule
      can :editable_schedules, Schedule
      # need further consideration on shift
      can :manage, Shift

      can :index, ShiftTrade
      can :select, ShiftTrade

      can :index, Swap
      can :show, Swap
      can :update, Swap
      can :cancel, Swap

      can :index, Timeoff do |t|
        t.user_id == user.id
      end
      can :create, Timeoff
      can :show, Timeoff
      can :update, Timeoff
      can :cancel, Timeoff
      can :check_unique_date, Timeoff

      # user part
      can :profile, User do |u|
        u.id = user.id
      end

      can :update, User do |u|
        u.id = user.id
      end

      can :org_members, User do |u|
        u.id = user.id
      end
	else
	  can :manage, :all  
	end	 
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pshq_engine-0.1.6 app/models/ability.rb
pshq_engine-0.1.5 app/models/ability.rb
pshq_engine-0.0.1 app/models/ability.rb