Wikicr::User
Inherits Acl::Entity / YAML::Serializable / Reference / Object
An User is a couple name/password/groups/token.
The name and groups is public, the password and the token are private.
The password is used to recognize an user when login in with a form for example.
The token is used to recognize an user by a cookie for exemple.
Constructors
new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
Sourcenew(name : String, password : String, groups : Array(String) = [] of String, token : String | Nil = nil)
User.new "admin", "password", %w(admin user)
User.new "nephos", "password", %w(user guest)
new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
SourceInstance methods
encrypt!
Encrypts the passwod using Crypto::Bcrypt.
Wikicr::User.new("admin", "password", %w(admin)).encrypt!.password # => "$2a$11$G2i2.Km1DRbJtqDBFRhKXuSn8IwNVt7AypAP328T1OYq0wBugkgCm"
generate_new_token!
Sourcegroups=(groups : Array(String))
Sourcehas_group?(group : String) : Bool
Returns true if the group is owned by the Entity, else false
name
Sourcename=(name : String)
Sourcepassword
Sourcepassword=(password : String)
Sourcetoken
Sourcetoken=(token : String | Nil)
Source