stats:proc:deleteaccount

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
stats:proc:deleteaccount [2011/09/29 00:06] – Patrick Michelstats:proc:deleteaccount [2013/07/10 12:34] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 <code xcend> <code xcend>
-deleteAccount(ident username) { +deleteAccount(ident uid, ident username) { 
-  assume exists //accounts/account[username];+  assume exists /account[uid]/admin; 
 +  assume uid != username; # or do we want to allow an admin to delete himself? 
 + 
 +  assume exists /account[username];
      
-  assume size(//accounts/account[username]/examiner) = 0; +  assume size(/account[username]/examiner) = 0; 
-  assume size(//accounts/account[username]/assistant) = 0; +  assume size(/account[username]/assistant) = 0; 
-  assume size(//accounts/account[username]/tutor) = 0;+  assume size(/account[username]/tutor) = 0;
  
   # not yet a constraint of the implementation, but is seems practically relevant :-)   # not yet a constraint of the implementation, but is seems practically relevant :-)
-  if exists //accounts/account[username]/admin then +  if exists /account[username]/admin then 
-    assume size(//accounts/account/admin) > 1;+    assume size(/account/admin) > 1;
   fi   fi
  
-  if exists //accounts/account[username]/student then +  if exists /account[username]/student then 
-    assume size(//exercises/exercise/students/student[//accounts/account[username]/student/id]) = 0; +    assume size(/exercise/student[/account[username]/student/id]) = 0; 
-    assume size(//exams/exam/results/participant[//accounts/account[username]/student/id]) = 0;+    assume size(/exam/participant[/account[username]/student/id]) = 0;
   fi   fi
      
-  remove //accounts/account[username]; +  remove /account[username]; 
-} # roles: admin+}
 </code> </code>
stats/proc/deleteaccount.1317247611.txt.gz · Last modified: by Patrick Michel

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki