UserDBTasks.dcl 1.44 KB
Newer Older
Bas Lijnse's avatar
Bas Lijnse committed
1
definition module UserDBTasks
2
/**
Bas Lijnse's avatar
Bas Lijnse committed
3
* This modules provides tasks to retrieve information from the user database
4 5 6
* of the iTask system. These tasks are useful when work is to be delegated to
* other users.
*/
7
import StdMaybe, Void
Bas Lijnse's avatar
Bas Lijnse committed
8

Bas Lijnse's avatar
Bas Lijnse committed
9 10
from TSt	import :: Task
from Types	import :: UserId
Bas Lijnse's avatar
Bas Lijnse committed
11
from UserDB	import :: User
Bas Lijnse's avatar
Bas Lijnse committed
12

Bas Lijnse's avatar
Bas Lijnse committed
13
from InteractionTasks 	import class html
14 15

/**
Bas Lijnse's avatar
Bas Lijnse committed
16
* Finds a specific user
17
*/
Bas Lijnse's avatar
Bas Lijnse committed
18
getUser 			:: !UserId		-> Task User
19
/**
Bas Lijnse's avatar
Bas Lijnse committed
20 21 22 23
* Finds a specific user by username
*/
getUserByName		:: !String		-> Task User
/**
Bas Lijnse's avatar
Bas Lijnse committed
24
* Finds all users
25
*/
Bas Lijnse's avatar
Bas Lijnse committed
26
getUsers			:: Task [User]
27 28 29
/**
* Finds all users (user id + display name) who have the given role
*/
Bas Lijnse's avatar
Bas Lijnse committed
30
getUsersWithRole	:: !String	-> Task [User]
Bas Lijnse's avatar
Bas Lijnse committed
31 32 33 34
/**
* Looks up the corresponding display names for a list of user ids
*/
getDisplayNames 	:: ![UserId] 	-> Task [String]
35
/**
Bas Lijnse's avatar
Bas Lijnse committed
36
* Looks up the corresponding user names for a list of user ids
37
*/
Bas Lijnse's avatar
Bas Lijnse committed
38
getUserNames		:: ![UserId]	-> Task [String]
39
/**
Bas Lijnse's avatar
Bas Lijnse committed
40
* Looks up the corresponding roles for a list of user ids
41
*/
Bas Lijnse's avatar
Bas Lijnse committed
42
getRoles			:: ![UserId]	-> Task [[String]]
Bas Lijnse's avatar
Bas Lijnse committed
43 44 45 46
/**
* Authenticates a user by username and password
*/
authenticateUser	:: !String !String	-> Task (Maybe User)
Bas Lijnse's avatar
Bas Lijnse committed
47

48 49 50
/**
* Add a new user
*/
51 52 53 54 55 56 57 58 59
createUser			:: !User -> Task User
/**
* Update an existing user
*/
updateUser			:: !User -> Task User
/**
* Delete an existing user
*/
deleteUser			:: !User -> Task User
60

Bas Lijnse's avatar
Bas Lijnse committed
61
//Interactively choose a user
Bas Lijnse's avatar
Bas Lijnse committed
62 63
chooseUser			:: !question			-> Task User | html question
chooseUserWithRole	:: !question !String	-> Task User | html question