User Tools

Site Tools


stats:schema:stats

This is an old revision of the document!


The Whole Stat System

The stats element represents the whole system, i.e. its XCend Schema is not repeated here. The main parts of the system are

Procedures

Account Management

Two of the most important procedures, as they create and remove elements of a major part of the system, namely User Accounts and Roles.

Naturally, a lot of things depend on accounts and their associated roles. Especially the student role restricts the deletion of accounts.

# This doesn't take account validation into consideration at all. It probably has to be allowed to replace an unvalidated account.
createAccount(ident uid, ident username, string lastName, string firstName, string email, string password) {
  assume exists /account[uid]/admin;
 
  assume not exists /account[username];
 
  insert / <account username=[username] lastName=[lastName] firstName=[firstName] email=[email] password=[password] />
}

Admin Management

The admin role procedures from User Accounts and Roles can be offered here, too.

grantAdminRights(ident uid, ident username) {
  assume exists /account[uid]/admin;
 
  assume exists /account[username]; # implicitly true in OO implementations
  assume not exists /account[username]/admin;
 
  insert /account[username] <admin />;
}
revokeAdminRights(ident uid, ident username) {
  assume exists /account[uid]/admin;
 
  assume exists /account[username]/admin; # implies the account exists, which is implicitly true anyway
 
  assume size(/account/admin) > 1; # kind of a practical constraint
 
  remove /account[username]/admin;
}
stats/schema/stats.1317237354.txt.gz · Last modified: 2011/09/28 21:15 by Patrick Michel