UserAdmin.icl 1.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
implementation module UserAdmin

import iTasks

userAdministration :: [Workflow]
userAdministration
	= [{Workflow|name = "Admin/Create user", label = "Create user ", roles = ["admin"], mainTask = createUserFlow}
	  ,{Workflow|name = "Admin/Update user", label = "Update user", roles = ["admin"], mainTask = updateUserFlow}
	  ,{Workflow|name = "Admin/Delete user", label = "Delete user", roles = ["admin"], mainTask = deleteUserFlow}
	  ]

createUserFlow :: Task Void
createUserFlow
	=	enterInformationA "Enter user information" [ActionCancel] [ActionOk]
	>>=	\(action,user) -> case action of
			ActionCancel	=	stop
			ActionOk		=	createUser user
							>>|	showMessage "Successfully added new user"

updateUserFlow :: Task Void
updateUserFlow
	=	getUsers
	>>= enterChoice "Which user do you want to update?"
	>>= updateInformation "Please make your changes"
	>>= updateUser
	>>| showMessage "Successfully updated user"

deleteUserFlow :: Task Void
deleteUserFlow
	=	getUsers
	>>=	enterChoice "Which user do you want to delete?"
	>>= deleteUser
	>>| showMessage "Successfully deleted user"