This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
stats:proc:granttutorrights [2011/09/27 20:47] Patrick Michel created |
stats:proc:granttutorrights [2013/07/10 12:33] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
<code xcend> | <code xcend> | ||
- | grantTutorRights(ident username, ident exerciseId, ident groupId) { | + | grantTutorRights(ident uid, ident username, ident exerciseId, ident groupId) { |
- | assume exists //accounts/account[username]; # implicitly true in OO implementations | + | assume exists /account[uid]/assistant[exerciseId]; |
- | assume exists //exercises/exercise[exerciseId]/groups/group[groupId]; | + | |
| | ||
- | assume not exists //accounts/account[username]/tutor[exerciseId]/group[groupId]); | + | assume exists /account[username]; # implicitly true in OO implementations |
- | assume not exists //exercises/exercise[exerciseId]/groups/group[groupId]/tutor[account]; # implied by integrity and the assumption before | + | assume exists /exercise[exerciseId]/group[groupId]; |
+ | |||
+ | assume not exists /account[username]/tutor[exerciseId]/group[groupId]); | ||
+ | assume not exists /exercise[exerciseId]/group[groupId]/tutor[username]; | ||
+ | # implied by integrity and the assumption before | ||
- | if not exists //accounts/account[username]/tutor[exerciseId] then # we could split the tutor rights here | + | if not exists /account[username]/tutor[exerciseId] then # we could split the tutor rights here |
- | insert //accounts/account[username] <tutor exercise=[exerciseId] />; | + | insert /account[username] <tutor exercise=[exerciseId] />; |
fi | fi | ||
- | insert //accounts/account[username]/tutor[exerciseId] <group id=[groupId] />; | + | insert /account[username]/tutor[exerciseId] <group id=[groupId] />; |
- | insert //exercises/exercise[exerciseId]/groups/group[groupId] <tutor account=[account] />; | + | insert /exercise[exerciseId]/group[groupId] <tutor account=[account] />; |
} | } | ||
</code> | </code> | ||