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
|
|
|
|
|
2019-10-07 18:06:55 +02:00
|
|
|
class ApplicationScope
|
2019-08-06 11:02:54 +02:00
|
|
|
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]
|
2019-08-06 11:02:54 +02:00
|
|
|
@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
|