This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
stats:proc:granttutorrights [2011/09/29 00:02] Patrick Michel |
stats:proc:granttutorrights [2012/05/29 16:45] Patrick Michel |
||
---|---|---|---|
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[uid]/assistant[exerciseId]; | ||
+ | | ||
assume exists //accounts/account[username]; # implicitly true in OO implementations | assume exists //accounts/account[username]; # implicitly true in OO implementations | ||
assume exists //exercises/exercise[exerciseId]/groups/group[groupId]; | assume exists //exercises/exercise[exerciseId]/groups/group[groupId]; | ||
| | ||
assume not exists //accounts/account[username]/tutor[exerciseId]/group[groupId]); | assume not exists //accounts/account[username]/tutor[exerciseId]/group[groupId]); | ||
- | assume not exists //exercises/exercise[exerciseId]/groups/group[groupId]/tutor[account]; # implied by integrity and the assumption before | + | assume not exists //exercises/exercise[exerciseId]/groups/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 //accounts/account[username]/tutor[exerciseId] then # we could split the tutor rights here | ||
Line 14: | Line 17: | ||
insert //accounts/account[username]/tutor[exerciseId] <group id=[groupId] />; | insert //accounts/account[username]/tutor[exerciseId] <group id=[groupId] />; | ||
insert //exercises/exercise[exerciseId]/groups/group[groupId] <tutor account=[account] />; | insert //exercises/exercise[exerciseId]/groups/group[groupId] <tutor account=[account] />; | ||
- | } # roles: assistant[id] | + | } |
</code> | </code> | ||