Commit 4a4eea9e authored by Job Cuppen's avatar Job Cuppen

working but not perfect login

parent f7ea12a9
......@@ -35,3 +35,9 @@ a.out.c
# End of https://www.gitignore.io/api/macos
*.prj
*.bc
*.pbc
*-data/
*-www/
Clean System Files/
/lcsm
module lcsm2
import iTasks
import StdDebug
:: LCSMWorkflowCollection =
{
workflows :: ![Workflow]
}
instance Startable LCSMWorkflowCollection
where
toStartable {LCSMWorkflowCollection|workflows} =
[onStartup (installWorkflows workflows)
,onStartup importUsers
,onStartup (assignWorkflows (hd workflows))
,onRequest "/" (loginAndManageWork "T" Nothing Nothing False)
]
assignWorkflows Workflow -> Task a
assignWorkflows w = "job" @:
:: LCSMUser = {name :: String, roles :: [String] }
lcsm_users :: [LCSMUser]
lcsm_users = [{LCSMUser|name="drvr", roles=["driver"]}
,{LCSMUser|name="job", roles=["designer","controller","driver"]}
,{LCSMUser|name="reg", roles=["designer","controller","driver"]}
,{LCSMUser|name="dsgnr", roles=["designer"]}
,{LCSMUser|name="ctrlr", roles=["controller"]}
]
importUsers :: Task [StoredUserAccount]
importUsers = allTasks (map (createUser o mkUserAccount) lcsm_users)
where
mkUserAccount {LCSMUser|name,roles} =
{ UserAccount|
credentials =
{ Credentials|
username = Username name,
password = Password name
},
title = Nothing,
roles = ["manager" : roles]
}
setup :: [Workflow] -> LCSMWorkflowCollection
setup w = { LCSMWorkflowCollection|workflows = w }
designTask = viewInformation [] "Designer Task"
controlTask = viewInformation [] "Controller Task"
driverTask = viewInformation [] "Driver Task"
lcsm_Workflows =
[restrictedWorkflow "Track Management" "This task manages how the tracks look like and how they are connected" ["designer"] designTask
,restrictedWorkflow "Signal Control" "This task manages which signals are red and which are green" ["controller"] controlTask
,restrictedWorkflow "Train Driving" "This task manages how to train(s) drive" ["driver"] driverTask
]
Start :: *World -> *World
Start world = doTasks (setup lcsm_Workflows) world
/*
Start :: *World -> *World
Start world = doTasks main world
:: LCSMUser = {name :: String, role :: String }
lcsm_users :: [LCSMUser]
lcsm_users = [{name="job", role="bekijker"}]
main :: Task ()
main = multiUserExample @!()
viewCurrentUser = viewSharedInformation [] currentUser
chooseTask = ent [] currentUser
multiUserExample = allTasks (map (createUser o mkUserAccount) lcsm_users)
>>| doAuthenticated viewCurrentUser
where
mkUserAccount {name,role} =
{ UserAccount|
credentials =
{ Credentials|
username = Username name,
password = Password name
},
title = Nothing,
roles = [role]
}
*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment