mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
- Add ApplicationPolicy base class - Add GamePolicy (owner or admin can access) - Add MissionPolicy (published visible to all) - Implement Scope for filtering records - Support admin and account_manager roles
54 lines
650 B
Ruby
54 lines
650 B
Ruby
module BreakEscape
|
|
class ApplicationPolicy
|
|
attr_reader :user, :record
|
|
|
|
def initialize(user, record)
|
|
@user = user
|
|
@record = record
|
|
end
|
|
|
|
def index?
|
|
false
|
|
end
|
|
|
|
def show?
|
|
false
|
|
end
|
|
|
|
def create?
|
|
false
|
|
end
|
|
|
|
def new?
|
|
create?
|
|
end
|
|
|
|
def update?
|
|
false
|
|
end
|
|
|
|
def edit?
|
|
update?
|
|
end
|
|
|
|
def destroy?
|
|
false
|
|
end
|
|
|
|
class Scope
|
|
def initialize(user, scope)
|
|
@user = user
|
|
@scope = scope
|
|
end
|
|
|
|
def resolve
|
|
raise NotImplementedError
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :user, :scope
|
|
end
|
|
end
|
|
end
|