Module: User::Authorization

Included in:
User
Defined in:
lib/generators/hello/install/templates/models/concerns/user/authorization.rb

Instance Method Summary collapse

Instance Method Details

#role_is?(string) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/hello/install/templates/models/concerns/user/authorization.rb', line 3

def role_is?(string)
  case string.to_s
  when 'guest'
    %w(guest).include?(role)
  when 'onboarding'
    %w(onboarding).include?(role)
  when 'user'
    %w(user webmaster).include?(role)
  when 'webmaster'
    %w(webmaster).include?(role)
  end
end