Commit 960624fb authored by Reg Huijben's avatar Reg Huijben

Added some custom workflowcollection stuff

parent f7ea12a9
......@@ -38,26 +38,93 @@ derive class iTask Connection
//users = [("dave","beun")]
:: LCSMUser = {name :: String, role :: String }
lcsm_users :: [LCSMUser]
lcsm_users = [{name="dave",role="bekijker"}]
lcsm_users = [{name="dave",role="bekijker"},{name="asd",role="bekijker"}]
//henkie :: Task ()
henkie = viewSharedInformation [] currentUser //viewInformation [] ()
//henkie = viewSharedInformation [] currentUser //viewInformation [] ()
zaft = [restrictedWorkflow "label bek" "desc" ["bekijker"] bekijkerViewTask,
restrictedWorkflow "label bep" "desc" ["bepaler"] bepalerViewTask
]
//henkie = installWorkflows zaft
//enterChoice [] /* ?? *///currentUser
// >>= (\w-> installWorkflows [w]) >>| (manageWorkOfCurrentUser Nothing)
//>>| loginAndManageWork "Meeting_4_3 Example" Nothing Nothing False
:: WorkflowCollection2 =
{ name :: !String
, loginMessage :: !Maybe HtmlTag
, welcomeMessage :: !Maybe HtmlTag
, allowGuests :: !Bool
, workflows :: ![Workflow]
}
instance Startable WorkflowCollection2
where
toStartable {WorkflowCollection2|name,loginMessage,welcomeMessage,allowGuests,workflows} =
[onStartup (installWorkflows workflows)
,onStartup multiUserExample
,onRequest "/" (loginAndManageWork name loginMessage welcomeMessage allowGuests)
]
bekijkerViewTask = viewInformation [] "Als bekijker, dit is de taak die draait"
bepalerViewTask = viewInformation [] "Als bepaler"
/*nextTask :: (SimpleSDSLens User) -> (Task String)
nextTask SystemUser = viewInformation [] "No"
nextTask (AnonymousUser s) = viewInformation [] "No"
nextTask (AuthenticatedUser id roles title)
| (isMember "bekijker" roles) = viewInformation [] "Als bekijker"
| (isMember "bepaler" roles) = viewInformation [] "Als bepaler"
*/
//main :: Task ()
//main = multiUserExample @! ()
usersWithRole :: !Role -> SDSLens () [User] ()
usersWithRole role = mapRead (filter (hasRole role)) users
where
hasRole role (AuthenticatedUser _ roles _) = isMember role roles
hasRole _ _ = False
//fff :: User
//fff = (get currentUser)
zever "a" = viewInformation [] "l"//(toString (fff>>= \f. hasRole "bekijker" f)) where
// hasRole role (AuthenticatedUser _ roles _) = isMember role roles//viewInformation [] "mijn bekijk taak"
zever "b" = viewInformation [] "mijn bepaal taak"
multiUserExample = allTasks (map (createUser o mkUserAccount) lcsm_users)
>>| doAuthenticated henkie //loginAndManageWork "Meeting_4_3 Example" Nothing Nothing False
//>>| installWorkflows zaft >>| loginAndManageWork "Zaftwf" Nothing Nothing False
//>>| doAuthenticated (enterChoice [] ["a","b"] >>= (\ch-> zever ch ) )
//loginAndManageWork "Meeting_4_3 Example" Nothing Nothing False
where
//mkUserAccount name = {UserAccount| credentials = {Credentials| username = Username name, password = Password name}, title = Nothing, roles = ["manager"] }
mkUserAccount {name,role} = {UserAccount| credentials = {Credentials| username = Username name, password = Password name}, title = Nothing, roles = [role] }
mkUserAccount {name,role} = {UserAccount| credentials = {Credentials| username = Username name, password = Password name}, title = Nothing, roles = [role, "manager"] }
/*
Start :: *World -> *World
Start world = doTasks main world
*/
//Start world = doTasks zaft world
motherfucker =
{ WorkflowCollection2
| name = "TEST"
, loginMessage = Nothing
, welcomeMessage = Nothing
, allowGuests = False
, workflows = zaft
}
Start world = doTasks motherfucker world
//Start world = doTasks (multiUserExample @! ()) world
main :: Task ()
main = multiUserExample @!()//w where
//main :: Task ()
//main = multiUserExample @!()//w where
// mkUserAccount name = {UserAccount| credentials = {Credentials| username = Username name, password = Password name}, title = Nothing, roles = ["manager"] }
//Start w = doTasks (myTask (toLines [(merge2D WN WE), WE]) ) w
......
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