mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
75 lines
958 B
Ruby
75 lines
958 B
Ruby
module BreakEscape
|
|
class GamePolicy < ApplicationPolicy
|
|
def show?
|
|
# Owner or admin/account_manager
|
|
record.player == user || user&.admin? || user&.account_manager?
|
|
end
|
|
|
|
def update?
|
|
show?
|
|
end
|
|
|
|
def scenario?
|
|
show?
|
|
end
|
|
|
|
def ink?
|
|
show?
|
|
end
|
|
|
|
def bootstrap?
|
|
show?
|
|
end
|
|
|
|
def sync_state?
|
|
show?
|
|
end
|
|
|
|
def update_room?
|
|
show?
|
|
end
|
|
|
|
def unlock?
|
|
show?
|
|
end
|
|
|
|
def inventory?
|
|
show?
|
|
end
|
|
|
|
def room?
|
|
show?
|
|
end
|
|
|
|
def objectives?
|
|
show?
|
|
end
|
|
|
|
def complete_task?
|
|
show?
|
|
end
|
|
|
|
def update_task_progress?
|
|
show?
|
|
end
|
|
|
|
def container?
|
|
show?
|
|
end
|
|
|
|
def submit_flag?
|
|
show?
|
|
end
|
|
|
|
class Scope < Scope
|
|
def resolve
|
|
if user&.admin? || user&.account_manager?
|
|
scope.all
|
|
else
|
|
scope.where(player: user)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|