<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
<year>1997</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
</legalnotice>
<title>mod_auth</title>
<prepared>Joakim Grebenö</prepared>
<docno></docno>
<date>1997-10-14</date>
<rev>2.3</rev>
<file>mod_auth.sgml</file>
</header>
<module>mod_auth</module>
<modulesummary>User authentication using text files, dets or mnesia database.</modulesummary>
<description>
<p>This module provides for basic user authentication using
textual files, dets databases as well as mnesia databases. </p>
<marker id="add_user"></marker>
</description>
<funcs>
<func>
<name>add_user(UserName, Options) -> true| {error, Reason}</name>
<name>add_user(UserName, Password, UserData, Port, Dir) -> true | {error, Reason}</name>
<name>add_user(UserName, Password, UserData, Address, Port, Dir) -> true | {error, Reason}</name>
<fsummary>Add a user to the user database.</fsummary>
<type>
<v>UserName = string()</v>
<v>Options = [Option]</v>
<v>Option = {password,Password} | {userData,UserData} | {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Password = string()</v>
<v>UserData = term()</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>AuthPassword =string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="user_api"></marker>
<marker id="add_user"></marker>
<p><c>add_user/2, add_user/5</c> and <c>add_user/6</c> adds a
user to the user
database. If the operation is successful, this function returns
<c>true</c>. If an error occurs, <c>{error,Reason}</c> is returned.
When <c>add_user/2</c> is called the Password,
UserData Port and Dir options is mandatory.</p>
<marker id="delete_user"></marker>
</desc>
</func>
<func>
<name>delete_user(UserName,Options) -> true | {error, Reason}</name>
<name>delete_user(UserName, Port, Dir) -> true | {error, Reason}</name>
<name>delete_user(UserName, Address, Port, Dir) -> true | {error, Reason}</name>
<fsummary>Delete a user from the user database.</fsummary>
<type>
<v>UserName = string()</v>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>AuthPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="delete_user"></marker>
<p><c>delete_user/2, delete_user/3</c> and <c>delete_user/4</c>
deletes a user from the user database.
If the operation is successful, this function returns <c>true</c>.
If an error occurs, <c>{error,Reason}</c> is returned.
When <c>delete_user/2</c> is called the Port and Dir options
are mandatory.</p>
<marker id="get_user"></marker>
</desc>
</func>
<func>
<name>get_user(UserName,Options) -> {ok, #httpd_user} |{error, Reason}</name>
<name>get_user(UserName, Port, Dir) -> {ok, #httpd_user} | {error, Reason}</name>
<name>get_user(UserName, Address, Port, Dir) -> {ok, #httpd_user} | {error, Reason}</name>
<fsummary>Returns a user from the user database.</fsummary>
<type>
<v>UserName = string()</v>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>AuthPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="get_user"></marker>
<p><c>get_user/2, get_user/3</c> and <c>get_user/4</c> returns a
<c>httpd_user</c> record containing the userdata for a
specific user. If the user cannot be found, <c>{error, Reason}</c>
is returned. When <c>get_user/2</c> is called the Port and Dir
options are mandatory.</p>
<marker id="list_users"></marker>
</desc>
</func>
<func>
<name>list_users(Options) -> {ok, Users} | {error, Reason}</name>
<name>list_users(Port, Dir) -> {ok, Users} | {error, Reason}</name>
<name>list_users(Address, Port, Dir) -> {ok, Users} | {error, Reason}</name>
<fsummary>List users in the user database.</fsummary>
<type>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>Users = list()</v>
<v>AuthPassword = string()</v>
<v>Reason = atom()</v>
</type>
<desc>
<marker id="list_users"></marker>
<p><c>list_users/1, list_users/2</c> and <c>list_users/3</c>
returns a list
of users in the user database for a specific <c>Port/Dir</c>.
When <c>list_users/1</c> is called the Port and Dir
options are mandatory.</p>
<marker id="add_group_member"></marker>
</desc>
</func>
<func>
<name>add_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name>
<name>add_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name>
<name>add_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}</name>
<fsummary>Add a user to a group.</fsummary>
<type>
<v>GroupName = string()</v>
<v>UserName = string()</v>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>AuthPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="add_group_member"></marker>
<p><c>add_group_member/3, add_group_member/4</c> and
<c>add_group_member/5</c>
adds a user to a group. If the group does not exist, it
is created and the user is added to the group. Upon successful
operation, this function returns <c>true</c>.
When <c>add_group_members/3</c>
is called the Port and Dir options are mandatory.</p>
<marker id="delete_group_member"></marker>
</desc>
</func>
<func>
<name>delete_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name>
<name>delete_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name>
<name>delete_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}</name>
<fsummary>Remove a user from a group.</fsummary>
<type>
<v>GroupName = string()</v>
<v>UserName = string()</v>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>AuthPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="delete_group_member"></marker>
<p><c>delete_group_member/3, delete_group_member/4</c> and
<c>delete_group_member/5</c> deletes a user from a group.
If the group or the user does not exist,
this function returns an error, otherwise it returns <c>true</c>.
When <c>delete_group_member/3</c> is called the Port and Dir options
are mandatory.</p>
<marker id="list_group_members"></marker>
</desc>
</func>
<func>
<name>list_group_members(GroupName, Options) -> {ok, Users} | {error, Reason}</name>
<name>list_group_members(GroupName, Port, Dir) -> {ok, Users} | {error, Reason}</name>
<name>list_group_members(GroupName, Address, Port, Dir) -> {ok, Users} | {error, Reason}</name>
<fsummary>List the members of a group.</fsummary>
<type>
<v>GroupName = string()</v>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>Users = list()</v>
<v>AuthPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="list_group_members"></marker>
<p><c>list_group_members/2, list_group_members/3</c> and
<c>list_group_members/4</c>
lists the members of a specified group. If the group does not
exist or there is an error, <c>{error, Reason}</c> is returned.
When <c>list_group_members/2</c> is called the Port and Dir options
are mandatory.</p>
<marker id="list_groups"></marker>
</desc>
</func>
<func>
<name>list_groups(Options) -> {ok, Groups} | {error, Reason}</name>
<name>list_groups(Port, Dir) -> {ok, Groups} | {error, Reason}</name>
<name>list_groups(Address, Port, Dir) -> {ok, Groups} | {error, Reason}</name>
<fsummary>List all the groups.</fsummary>
<type>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>Groups = list()</v>
<v>AuthPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="list_groups"></marker>
<p><c>list_groups/1, list_groups/2</c> and <c>list_groups/3</c>
lists all the groups available.
If there is an error, <c>{error, Reason}</c> is returned.
When <c>list_groups/1</c> is called the Port and Dir options
are mandatory.</p>
<marker id="delete_group"></marker>
</desc>
</func>
<func>
<name>delete_group(GroupName, Options) -> true | {error,Reason} <name>delete_group(GroupName, Port, Dir) -> true | {error, Reason}</name>
<name>delete_group(GroupName, Address, Port, Dir) -> true | {error, Reason}</name>
<fsummary>Deletes a group</fsummary>
<type>
<v>Options = [Option]</v>
<v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>GroupName = string()</v>
<v>AuthPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="delete_group"></marker>
<p><c>delete_group/2, delete_group/3</c> and <c>delete_group/4</c>
deletes the group specified and returns <c>true</c>.
If there is an error, <c>{error, Reason}</c> is returned.
When <c>delete_group/2</c> is called the
Port and Dir options are mandatory.</p>
<marker id="update_password"></marker>
</desc>
</func>
<func>
<name>update_password(Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}</name>
<name>update_password(Address,Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}</name>
<fsummary>Change the AuthAcessPassword</fsummary>
<type>
<v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
<v>Dir = string()</v>
<v>GroupName = string()</v>
<v>OldPassword = string()</v>
<v>NewPassword = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<marker id="update_password"></marker>
<p><c>update_password/5</c> and <c>update_password/6</c>
Updates the AuthAccessPassword for the specified directory.
If NewPassword is equal to "NoPassword" no password is requires to
change authorisation data.
If NewPassword is equal to "DummyPassword" no changes can be done
without changing the password first.</p>
</desc>
</func>
</funcs>
<section>
<marker id="see_also"></marker>
<title>SEE ALSO</title>
<p><seealso marker="httpd">httpd(3)</seealso>,
<seealso marker="mod_alias">mod_alias(3)</seealso>,</p>
</section>
</erlref>