Files
puzzle-scoreboard/app/policies/event_policy.rb
sto 35b304d913
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Events: initial implementation
2026-07-26 14:01:29 +02:00

26 lines
322 B
Ruby

class EventPolicy < ApplicationPolicy
def owner_or_admin
if record == :event
true
else
record.user.id == user.id || user.admin?
end
end
def index?
owner_or_admin
end
def new?
owner_or_admin
end
def create?
owner_or_admin
end
def show?
owner_or_admin
end
end