mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 06:51:41 +00:00
fix: establecer un parámetro por defecto #12754
This commit is contained in:
parent
75c4d3264d
commit
7a13dffc9b
2 changed files with 10 additions and 6 deletions
|
@ -72,6 +72,8 @@ class UsuariesController < ApplicationController
|
|||
site_usuarie = SiteUsuarie.new(@site, current_usuarie)
|
||||
authorize site_usuarie
|
||||
|
||||
params[:invite_as] = invited_as :invite_as
|
||||
|
||||
@policy = policy(site_usuarie)
|
||||
end
|
||||
|
||||
|
@ -155,12 +157,10 @@ class UsuariesController < ApplicationController
|
|||
|
||||
# El tipo de invitación que tenemos que enviar, si alguien mandó
|
||||
# cualquier cosa, usamos el privilegio menor.
|
||||
def invited_as
|
||||
if Rol::ROLES.include?(params[:invited_as])
|
||||
params[:invited_as]
|
||||
else
|
||||
'invitade'
|
||||
end
|
||||
#
|
||||
# @return [String]
|
||||
def invited_as(param_key = :invited_as)
|
||||
Rol.role?(params[param_key]) ? params[param_key] : Rol::INVITADE
|
||||
end
|
||||
|
||||
def site
|
||||
|
|
|
@ -21,4 +21,8 @@ class Rol < ApplicationRecord
|
|||
def usuarie?
|
||||
rol == USUARIE
|
||||
end
|
||||
|
||||
def self.role?(rol)
|
||||
ROLES.include? rol
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue