demarches-normaliennes/app/policies/application_policy.rb

54 lines
698 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2019-06-27 16:26:07 +02:00
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 ApplicationScope
attr_reader :user, :instructeur, :administrateur, :scope
2019-06-27 16:26:07 +02:00
2019-08-01 15:48:27 +02:00
def initialize(account, scope)
@user = account[:user]
@instructeur = account[:instructeur]
2019-08-01 15:48:27 +02:00
@administrateur = account[:administrateur]
2019-06-27 16:26:07 +02:00
@scope = scope
end
def resolve
scope.all
end
end
end