Commit b245d911 authored by Bas Lijnse's avatar Bas Lijnse

Removed getCurrentUser TSt function because of name clash

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@740 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 1b64ac7a
......@@ -57,10 +57,9 @@ where
setProcessOwner :: !UserId !pid -> Task Bool | toProcessId pid
setProcessOwner uid pid = mkInstantTask "setProcessOwner" setProcessOwner`
where
setProcessOwner` tst
# (cur,tst) = getCurrentUser tst //Current user is the new delegator of the process
setProcessOwner` tst=:{staticInfo}
# (user,tst) = getUser uid tst
# (delegator,tst) = getUser cur tst
# delegator = staticInfo.currentSession.user //Current user is the new delegator of the process
= ProcessDB@setProcessOwner (user.User.userId,user.User.displayName) (delegator.User.userId,delegator.User.displayName) (toProcessId pid) tst
......
......@@ -5,7 +5,6 @@ from TSt import :: Task, :: TSt(..), :: Store, :: HTTPRequest, :: Config
from TSt import :: ChangeLifeTime, :: StaticInfo(..), :: Options, :: Workflow
from TSt import mkInstantTask, mkMonitorTask
from TSt import accWorldTSt, loadProcessResult, taskLabel, taskNrFromString
from TSt import qualified getCurrentUser
from TSt import qualified createTaskInstance
import Types
......@@ -29,9 +28,8 @@ import GenPrint, GenParse, GenVisualize, GenUpdate
getCurrentUser :: Task User
getCurrentUser = mkInstantTask "getCurrentUserId" getCurrentUser`
where
getCurrentUser` tst
# (cur,tst) = TSt@getCurrentUser tst
= UserDB@getUser cur tst
getCurrentUser` tst=:{staticInfo}
= (staticInfo.currentSession.user,tst)
getCurrentProcessId :: Task ProcessId
getCurrentProcessId = mkInstantTask "getCurrentProcessId" getCurrentProcessId`
......@@ -48,10 +46,9 @@ where
spawnProcess :: !UserId !Bool !(Task a) -> Task (ProcessRef a) | iTask a
spawnProcess uid activate task = mkInstantTask "spawnProcess" spawnProcess`
where
spawnProcess` tst=:{TSt|mainTask}
# (curUid,tst) = TSt@getCurrentUser tst
# (user,tst) = UserDB@getUser uid tst
# properties =
spawnProcess` tst=:{TSt|mainTask,staticInfo}
# user = staticInfo.currentSession.user
# properties =
{ TaskManagerProperties
| worker = (user.User.userId,user.User.displayName)
, subject = taskLabel task
......
......@@ -5,7 +5,6 @@ from TSt import mkInstantTask
import StdList, StdMaybe
from UserDB import :: User
from UserDB import qualified getCurrentUser
from UserDB import qualified getUser
from UserDB import qualified getUserByName
from UserDB import qualified getUsers
......
......@@ -21,9 +21,8 @@ where
response taskid = "{\"success\" : true, \"taskid\": \"" +++ taskid +++ "\"}"
startWorkflow :: !Workflow !*TSt -> (!ProcessId,!*TSt)
startWorkflow workflow tst
# (uid,tst) = getCurrentUser tst
# (user,tst) = getUser uid tst
startWorkflow workflow tst=:{staticInfo}
# user = staticInfo.currentSession.user
# properties = { worker = (user.User.userId, user.User.displayName)
, subject = workflow.Workflow.label
, priority = NormalPriority
......
......@@ -40,13 +40,12 @@ where
parsePrio _ = Nothing
updateUser proc userId tst
updateUser proc userId tst=:{staticInfo}
| userId < 0
= (errorResponse "Invalid user id", tst) //Only positive user ids are possible
| otherwise
# (delegatorId,tst) = getCurrentUser tst
# (user,tst) = getUser userId tst
# (delegator,tst) = getUser delegatorId tst
# delegator = staticInfo.currentSession.user
# (_,tst) = updateProcessProperties proc (\p -> {TaskProperties| p & systemProps = {p.systemProps & manager = (delegator.User.userId,delegator.User.displayName)},managerProps = {p.managerProps & worker = (user.User.userId,user.User.displayName)}, workerProps = {p.workerProps & progress = TPActive}}) tst
= (successResponse,tst)
......
......@@ -29,8 +29,8 @@ derive JSONEncode WorkList, WorkListItem, TaskPriority, TaskProgress
JSONEncode{|Timestamp|} (Timestamp x) c = JSONEncode{|*|} x c
handleWorkListRequest :: !HTTPRequest !*TSt -> (!HTTPResponse, !*TSt)
handleWorkListRequest request tst
# (uid, tst) = getCurrentUser tst
handleWorkListRequest request tst=:{staticInfo}
# uid = staticInfo.currentSession.user.User.userId
# (processes,tst) = getProcessesForUser uid [Active] tst
# workitems = bldWorkItems processes
# worklist = { success = True
......
......@@ -9,7 +9,7 @@ import UserDB, ProcessDB
import GenVisualize, GenUpdate, TUIDefinition
handleWorkTabRequest :: !HTTPRequest !*TSt -> (!HTTPResponse, !*TSt)
handleWorkTabRequest req tst
handleWorkTabRequest req tst=:{staticInfo}
# (tree, tst) = calculateTaskTree taskId tst // Calculate the task tree
= case tree of
(TTMainTask ti properties tasks)
......@@ -23,7 +23,7 @@ handleWorkTabRequest req tst
# (debuginfo,tst)
= if debug (collectDebugInfo tree tst) (Nothing, tst)
// Check the user who has to do the work: if not the correct user, give task redundant message.
# (uid,tst) = getCurrentUser tst
# uid = staticInfo.currentSession.Session.user.User.userId
| uid == fst properties.managerProps.TaskManagerProperties.worker
// Update the task timestamps
# tst = updateTimeStamps properties.systemProps.TaskSystemProperties.processId tst
......
......@@ -167,10 +167,6 @@ accWorldTSt :: !.(*World -> *(.a,*World))!*TSt -> (.a,!*TSt)
*/
getCurrentSession :: !*TSt -> (!Session, !*TSt)
/**
* Extract the user id of the current session in the TSt
*/
getCurrentUser :: !*TSt -> (!UserId, !*TSt)
/**
* Get the id of the current process in the TSt
*/
......
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