This shows you the differences between two versions of the page.
stats:proc:grantassistantrights [2011/09/29 19:31] Patrick Michel |
stats:proc:grantassistantrights [2013/07/10 12:32] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Grant Assistant Rights ====== | ||
- | |||
- | <code xcend> | ||
- | grantAssistantRights(ident uid, ident username, ident exerciseId) { | ||
- | assume exists //accounts/account[uid]/admin; | ||
- | |||
- | assume exists //accounts/account[username]; # implicitly true in OO implementations | ||
- | assume exists //exercises/exercise[exerciseId]; | ||
- | |||
- | assume not exists //accounts/account[username]/assistant[exerciseId]); | ||
- | assume not exists //exercises/exercise[exerciseId]/assistant[account]; # implied by integrity and the assumption before | ||
- | |||
- | insert //accounts/account[username] <assistant exercise=[exerciseId] />; | ||
- | insert //exercises/exercise[exerciseId] <assistant account=[account] />; | ||
- | } | ||
- | </code> | ||
- | |||