aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/calendar_policy.rb
blob: d340bfdda247cfee10f0210ab298f6f4e5baf4b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class CalendarPolicy < ApplicationPolicy
  class Scope < Scope
    def resolve
      scope
    end
  end

  def show?
    organisation_match? || record.shared
  end

  def new?     ; modify?  end
  def create?  ; new? end

  def edit?    ; modify? end
  def update?  ; edit? end

  def destroy? ; modify? end

  def share?
    # something like current_user.has_permission(:shared_calendar)
    true
  end

  def modify?
    organisation_match?
  end

  def organisation_match?
    true
    #current_organisation == record.organisation
  end
end