Class: Decidim::User

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/user.rb

Overview

A User is a citizen that wants to join the platform to participate.

Constant Summary collapse

ROLES =
%w(admin moderator official).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#invitation_instructionsObject

Public: Allows customizing the invitation instruction email content when inviting a user.

Returns a String.



28
29
30
# File 'app/models/decidim/user.rb', line 28

def invitation_instructions
  @invitation_instructions
end

Instance Method Details

#abilityObject

Gets the ability instance for the given user.



33
34
35
# File 'app/models/decidim/user.rb', line 33

def ability
  @ability ||= Ability.new(self)
end

#role?(role) ⇒ Boolean

Checks if the user has the given ‘role` or not.

role - a String or a Symbol that represents the role that is being

checked

Returns a boolean.

Returns:

  • (Boolean)


43
44
45
# File 'app/models/decidim/user.rb', line 43

def role?(role)
  roles.include?(role.to_s)
end