aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/calendar_policy.rb
blob: d3c715d70c6bc6f817650d80139f497102889c6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class CalendarPolicy < ApplicationPolicy
  class Scope < Scope
    def resolve
      scope
    end
  end

  def create? 
    !archived? && organisation_match? && user.has_permission?('calendars.create')
  end
  def destroy?
    !archived? && organisation_match? && user.has_permission?('calendars.destroy')
  end
  def update?
    !archived? && organisation_match? && user.has_permission?('calendars.update')
  end

  def share?
    user.organisation.name == 'STIF' # FIXME
  end

end