mod_auth(3erl)

πŸ’… mod_auth β€” Erlang Module Definition (she's from inets 8.3.1.2, bestie) πŸ¦‹

Okay so real talk: this page is the module definition for mod_auth, and it's literally the glow-up your web server needs when you want actual users instead of vibes. ✨


🌸 NAME 🌸

mod_auth β€” User authentication using text files, Dets, or Mnesia database. πŸŽ€


✨ DESCRIPTION ✨

This module provides for basic user authentication using textual files, Dets databases, or Mnesia databases.

That's it, that's the whole vibe. Three whole storage eras β€” text files, Dets, Mnesia β€” one module, main character energy only. πŸ‘‘


πŸ‘‘ EXPORTS πŸ‘‘

πŸ“ add_group_member

add_group_member(GroupName, UserName, Options) -> true | {error, Reason}
add_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}
add_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}

Types:

GroupName = string()
UserName = string()
Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
AuthPassword = string()
Reason = term()

add_group_member/3, add_group_member/4, and add_group_member/5 each adds a user to a group. And like β€” if the group doesn't exist yet? It gets created, and the user is added to it. Iconic behaviour honestly, she does the work for you. 🫢

Upon successful operation, this function returns true. When add_group_members/3 is called, options Port and Dir are mandatory.

Heads up bestie, yes that says add_group_members/3 with an "s" β€” that's what the docs say, so we're saying it too πŸ’€

πŸŽ€ add_user

add_user(UserName, Options) -> true| {error, Reason}
add_user(UserName, Password, UserData, Port, Dir) -> true | {error, Reason}
add_user(UserName, Password, UserData, Address, Port, Dir) -> true | {error, Reason}

Types:

UserName = string()
Options = [Option]
Option = {password,Password} | {userData,UserData} | {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Password = string()
UserData = term()
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
AuthPassword = string()
Reason = term()

add_user/2, add_user/5, and add_user/6 each adds a user to the user database. If the operation is successful, this function returns true. If an error occurs, {error,Reason} is returned. And when add_user/2 is called, options Password, UserData, Port, and Dir are mandatory β€” all four, no skipping, she will notice. 😀


πŸ¦‹ delete_group

delete_group(GroupName, Options) -> true | {error,Reason}
delete_group(GroupName, Port, Dir) -> true | {error, Reason}
delete_group(GroupName, Address, Port, Dir) -> true | {error, Reason}

Types:

Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
GroupName = string()
AuthPassword = string()
Reason = term()

delete_group/2, delete_group/3, and delete_group/4 each deletes the group specified and returns true. If there is an error, {error, Reason} is returned. When delete_group/2 is called, option Port and Dir are mandatory.

Bye bestie, your group is gone, no notes. πŸ’…


🌈 delete_group_member

delete_group_member(GroupName, UserName, Options) -> true | {error, Reason}
delete_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}
delete_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}

Types:

GroupName = string()
UserName = string()
Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
AuthPassword = string()
Reason = term()

delete_group_member/3, delete_group_member/4, and delete_group_member/5 each deletes a user from a group. If the group or the user does not exist, this function returns an error, otherwise true. Lowkey strict but fair. πŸ™ˆ

When delete_group_member/3 is called, the options Port and Dir are mandatory.


🧚 delete_user

delete_user(UserName,Options) -> true | {error, Reason}
delete_user(UserName, Port, Dir) -> true | {error, Reason}
delete_user(UserName, Address, Port, Dir) -> true | {error, Reason}

Types:

UserName = string()
Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
AuthPassword = string()
Reason = term()

delete_user/2, delete_user/3, and delete_user/4 each deletes a user from the user database. If the operation is successful, this function returns true. If an error occurs, {error,Reason} is returned. When delete_user/2 is called, options Port and Dir are mandatory.

User? Never heard of her. πŸ«₯


πŸ’– get_user

get_user(UserName,Options) -> {ok, #httpd_user} |{error, Reason}
get_user(UserName, Port, Dir) -> {ok, #httpd_user} | {error, Reason}
get_user(UserName, Address, Port, Dir) -> {ok, #httpd_user} | {error, Reason}

Types:

UserName = string()
Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
AuthPassword = string()
Reason = term()

get_user/2, get_user/3, and get_user/4 each returns an httpd_user record containing the userdata for a specific user. So like, actual receipts. 🧾✨ If the user cannot be found, {error, Reason} is returned. When get_user/2 is called, options Port and Dir are mandatory.


⭐ list_groups

list_groups(Options) -> {ok, Groups} | {error, Reason}
list_groups(Port, Dir) -> {ok, Groups} | {error, Reason}
list_groups(Address, Port, Dir) -> {ok, Groups} | {error, Reason}

Types:

Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
Groups = list()
AuthPassword = string()
Reason = term()

list_groups/1, list_groups/2, and list_groups/3 each lists all the groups available β€” the whole roster, fr fr. πŸ“‹ If there is an error, {error, Reason} is returned. When list_groups/1 is called, options Port and Dir are mandatory.


πŸ”₯ list_group_members

list_group_members(GroupName, Options) -> {ok, Users} | {error, Reason}
list_group_members(GroupName, Port, Dir) -> {ok, Users} | {error, Reason}
list_group_members(GroupName, Address, Port, Dir) -> {ok, Users} | {error, Reason}

Types:

GroupName = string()
Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
Users = list()
AuthPassword = string()
Reason = term()

list_group_members/2, list_group_members/3, and list_group_members/4 each lists the members of a specified group. Group chat attendance check, basically. πŸ«‚ If the group does not exist or there is an error, {error, Reason} is returned. When list_group_members/2 is called, options Port and Dir are mandatory.


πŸ’œ list_users

list_users(Options) -> {ok, Users} | {error, Reason}
list_users(Port, Dir) -> {ok, Users} | {error, Reason}
list_users(Address, Port, Dir) -> {ok, Users} | {error, Reason}

Types:

Options = [Option]
Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}
Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
Users = list()
AuthPassword = string()
Reason = atom()

list_users/1, list_users/2, and list_users/3 each returns a list of users in the user database for a specific Port/Dir. When list_users/1 is called, options Port and Dir are mandatory.

Okay tiny detail that highkey matters: for this one Reason = atom(), not term() like every other function on this page. She's different, she's special, notice her. πŸ’€βœ¨

πŸŽ€ update_password

update_password(Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}
update_password(Address,Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}

Types:

Port = integer()
Address = {A,B,C,D} | string() | undefined
Dir = string()
GroupName = string()
OldPassword = string()
NewPassword = string()
Reason = term()

update_password/5 and update_password/6 each updates AuthAccessPassword for the specified directory. Glow-up your credentials, slay. πŸ”

If NewPassword is equal to "NoPassword", no password is required to change authorisation data. If NewPassword is equal to "DummyPassword", no changes can be done without changing the password first.

Bestie read that twice β€” those two magic strings are literally the whole lock/unlock switch, so don't be out here typing them for fun. 😭

🌟 SEE ALSO 🌟


That's the whole page, bestie β€” brought to you by Ericsson AB, running on inets 8.3.1.2, and yes the manual page header for this one is mod_auth(3erl) (we folded it up top, you're welcome πŸŽ€). Go authenticate something responsibly, mwah πŸ’‹βœ¨πŸŒ·

πŸ“¦ where this page comes from