UserDB.dcl 3.13 KB
Newer Older
1
definition module UserDB
Bas Lijnse's avatar
Bas Lijnse committed
2
/**
3
* This module provides the iTasks user database. It provides
Bas Lijnse's avatar
Bas Lijnse committed
4 5
* functions for accessing information about system users.
*/
6
import StdMaybe
7
import TSt
8

Bas Lijnse's avatar
Bas Lijnse committed
9 10 11 12 13 14 15 16 17 18
/**
* Fetches the id and display name from the user database for a given user id.
*
* @param A user id
* @param A unique user database handle
* @return The user
* @return The database handle
*/
getUser				::	!Int			!*TSt -> (!User						, !*TSt)
/**
Bas Lijnse's avatar
Bas Lijnse committed
19 20 21 22 23 24 25 26 27
* Fetches the id and display name from the user database for a given user id.
*
* @param A username
* @param A unique user database handle
* @return The user
* @return The database handle
*/
getUserByName		::	!String			!*TSt -> (!User						, !*TSt)
/**
Bas Lijnse's avatar
Bas Lijnse committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
* Fetches the id and display name of all users from the from the user database.
*
* @param A unique user database handle
* @return The list of users
* @return The database handle
*/
getUsers 			:: 					!*TSt -> (![User]					, !*TSt)
/**
* Finds a list of users that have a certain role.
*
* @param The role to look for
* @param A unique user database handle
* @return A list of users
* @return The database handle
*/
getUsersWithRole	:: !String			!*TSt -> (![User]				, !*TSt)
/**
* Maps a list of user ids to a list of display names. Display names are strings which
* are suited for displaying directly in a user interface. For example "John Doe".
*
* @param A list of user ids
* @param A unique user database handle
* @return A list of display names
* @return The database handle
*/
getDisplayNames		:: ![Int]			!*TSt -> (![String]						, !*TSt)
/**
* Maps a list of user ids to a list user names. These user names are typically strings with
* certain limitations that are used to uniquely identify  users.
*
* @param A list of user ids
* @param A unique user database handle
* @return A list of user names
* @return The database handle
*/
getUserNames		:: ![Int]			!*TSt -> (![String]						, !*TSt)
/**
* Maps a list of user ids to a list of a list of roles. Roles are strings that identify a certain
* role a user may play in a workflow scenario and can be used to determine what a user is allowed
* to do.
*
* @param A list of user ids
* @param A unique user database handle
* @return A list of a list of roles (a list of roles for each user)
* @return The database handle 
*/
getRoles			:: ![Int]			!*TSt -> (![[String]]					, !*TSt)
/**
* Authenticate a user based on a user name or password
*
* @param A user name
* @param A password
* @param A unique database handle
* @return When successful, A triple of user id/ display name/ list of roles.
* @return The database handle
*/
84 85 86 87
authenticateUser	:: !String !String	!*TSt -> (!Maybe User, !*TSt)
/**
* Create a new user
*
88 89 90
* @param A new user
* @param A unique database handle
*
91 92 93
* @return A user
* @return The database handle
*/
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
createUser :: !User !*TSt -> (!User,!*TSt)

/**
* Update an existing user
* 
* @param An existing user
* @param A unique database handle
*
* @return The existing user
* @retrun The database handle 
*/
updateUser :: !User !*TSt -> (!User,!*TSt)

/**
* Delete an existing user
*
* @param An existing user
* @param A unique database handle
*
* @return The existing user
* @retrun The database handle 
*/
deleteUser :: !User !*TSt -> (!User,!*TSt)