Module m_identity

Manage identities of users.

Copyright 2009-2013 Marc Worrell Date: 2009-04-25

Behaviours: gen_model.

Authors: Marc Worrell (marc@worrell.nl).

Description

Manage identities of users. An identity can be an username/password, openid, oauth credentials etc.

Function Index

check_username_pw/3Return the rsc_id with the given username/password.
delete/2
delete_by_type/3
delete_by_type_and_key/4
delete_username/2Delete an username from a resource.
get/2Fetch a specific identity entry.
get_rememberme_token/2Find the 'rememberme' cookie value for the user, generate a new one if not found.
get_rsc/2Fetch all credentials belonging to the user "id".
get_rsc/3
get_rsc_by_type/3Fetch all credentials belonging to the user "id" and of a certain type.
get_username/1Return the username of the current user.
get_username/2Return the username of the resource id, undefined if no username.
hash/1Hash a password, using sha1 and a salt.
hash_is_equal/2Compare if a password is the same as a hash.
insert/4Create an identity record.
insert/5
insert_unique/4Create an unique identity record.
insert_unique/5
is_user/2Check if the resource has any credentials that will make him/her an user.
is_valid_key/3
is_verified/2Check if there is a verified identity for the user, beyond the username_pw.
lookup_by_rememberme_token/2Find the user id connected to the 'rememberme' cookie value.
lookup_by_type_and_key/3
lookup_by_type_and_key_multi/3
lookup_by_username/2
lookup_by_verify_key/2
m_find_value/3Fetch the value for the key from a model source.
m_to_list/2Transform a m_config value to a list, used for template loops.
m_value/2Transform a model value so that it can be formatted or piped through filters.
normalize_key/2
reset_rememberme_token/2Reset the 'rememberme' cookie value.
set_by_type/4
set_by_type/5
set_username/3Change the username of the resource id, only possible if there is already an username/password set.
set_username_pw/4Set the username/password of a resource.
set_verified/2Set the verified flag on a record by identity id.
set_verified/4Set the verified flag on a record by rescource id, identity type and value (eg an user's email address).
set_verify_key/2

Function Details

check_username_pw/3

check_username_pw(Username, Password, Context) -> {ok, Id} | {error, Reason}

Return the rsc_id with the given username/password. If succesful then updates the 'visited' timestamp of the entry.

delete/2

delete(IdnId, Context) -> any()

delete_by_type/3

delete_by_type(RscId, Type, Context) -> any()

delete_by_type_and_key/4

delete_by_type_and_key(RscId, Type, Key, Context) -> any()

delete_username/2

delete_username(Id::ResourceId, Context) -> void

Delete an username from a resource.

get/2

get(IdnId, Context) -> any()

Fetch a specific identity entry.

get_rememberme_token/2

get_rememberme_token(UserId::pos_integer(), Context::#context{}) -> {ok, binary()}

Find the 'rememberme' cookie value for the user, generate a new one if not found.

get_rsc/2

get_rsc(Id::integer(), Context::context()) -> list()

Fetch all credentials belonging to the user "id"

get_rsc/3

get_rsc(Id, Type, Context) -> any()

get_rsc_by_type/3

get_rsc_by_type(Id, Type, Context) -> any()

Fetch all credentials belonging to the user "id" and of a certain type

get_username/1

get_username(Context) -> Username | undefined

Return the username of the current user

get_username/2

get_username(Id::ResourceId, Context) -> Username | undefined

Return the username of the resource id, undefined if no username

hash/1

hash(Pw::Password) -> tuple()

Hash a password, using sha1 and a salt

hash_is_equal/2

hash_is_equal(Pw::Password, X2::Hash) -> bool()

Compare if a password is the same as a hash.

insert/4

insert(RscId, Type, Key, Context) -> any()

Create an identity record.

insert/5

insert(RscId, Type, Key, Props, Context) -> any()

insert_unique/4

insert_unique(RscId, Type, Key, Context) -> any()

Create an unique identity record.

insert_unique/5

insert_unique(RscId, Type, Key, Props, Context) -> any()

is_user/2

is_user(Id, Context) -> any()

Check if the resource has any credentials that will make him/her an user

is_valid_key/3

is_valid_key(Type, Key, Context) -> any()

is_verified/2

is_verified(RscId, Context) -> any()

Check if there is a verified identity for the user, beyond the username_pw

lookup_by_rememberme_token/2

lookup_by_rememberme_token(Token::binary(), Context::#context{}) -> {ok, pos_integer()} | {error, enoent}

Find the user id connected to the 'rememberme' cookie value.

lookup_by_type_and_key/3

lookup_by_type_and_key(Type, Key, Context) -> any()

lookup_by_type_and_key_multi/3

lookup_by_type_and_key_multi(Type, Key, Context) -> any()

lookup_by_username/2

lookup_by_username(Key, Context) -> any()

lookup_by_verify_key/2

lookup_by_verify_key(Key, Context) -> any()

m_find_value/3

m_find_value(Id::Key, M::Source, Context) -> term()

Fetch the value for the key from a model source

m_to_list/2

m_to_list(M::Source, Context) -> List

Transform a m_config value to a list, used for template loops

m_value/2

m_value(M::Source, Context) -> term()

Transform a model value so that it can be formatted or piped through filters

normalize_key/2

normalize_key(Type, Key) -> any()

reset_rememberme_token/2

reset_rememberme_token(UserId::pos_integer(), Context::#context{}) -> {ok, binary()}

Reset the 'rememberme' cookie value. Needed if an user's password is changed.

set_by_type/4

set_by_type(RscId, Type, Key, Context) -> any()

set_by_type/5

set_by_type(RscId, Type, Key, Props, Context) -> any()

set_username/3

set_username(Id::ResourceId, Username, Context) -> ok | {error, Reason}

Change the username of the resource id, only possible if there is already an username/password set

set_username_pw/4

set_username_pw(Id::RscId, Username, Password, Context) -> ok | {error, Reason}

Set the username/password of a resource. Replaces any existing username/password.

set_verified/2

set_verified(Id, Context) -> any()

Set the verified flag on a record by identity id.

set_verified/4

set_verified(RscId, Type, Key, Context) -> any()

Set the verified flag on a record by rescource id, identity type and value (eg an user's email address).

set_verify_key/2

set_verify_key(Id, Context) -> any()


Generated by EDoc, Jul 29 2014, 17:16:18.