2019-03-26 15:32:20 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-03 23:25:23 +00:00
|
|
|
# Política de acceso para Invitades
|
|
|
|
#
|
|
|
|
# TODO: Incorporar a Usuarie y eliminar
|
2019-02-11 19:14:55 +00:00
|
|
|
class InvitadxPolicy
|
|
|
|
attr_reader :usuarix, :model
|
|
|
|
|
|
|
|
def initialize(usuarix, model)
|
|
|
|
@usuarix = usuarix
|
|
|
|
@model = model
|
|
|
|
end
|
|
|
|
|
|
|
|
def new?
|
|
|
|
create?
|
|
|
|
end
|
|
|
|
|
|
|
|
# Al crear, el modelo recibido es un sitio
|
|
|
|
def create?
|
2019-07-03 23:25:23 +00:00
|
|
|
unless model.class == Site
|
|
|
|
raise ArgumentError,
|
|
|
|
"#{model.class} must be Site"
|
|
|
|
end
|
2019-02-11 19:14:55 +00:00
|
|
|
|
|
|
|
# El sitio acepta invitadxs
|
|
|
|
model.invitadxs?
|
|
|
|
end
|
|
|
|
end
|