if(targetRank == null)
throw new CommandFailedWithDetailsException("Invalid rank: " + targetAccess);
if(!superUser) {
if(subjectAccount.equals(commanderAccount))
throw new InsufficientAccessException("to modify your self", true);
int commanderAccess = 0;
if(commanderAccount != null)
commanderAccess = commanderAccount.getAccess();
// TODO: get addMax from the database
int addMax = commanderAccess - 1;
if(targetAccess > addMax)
throw new InsufficientAccessException("to add users beyond " + addMax, true);
if(originalAccess >= commanderAccess)
throw new InsufficientAccessException("to add users ranked above " + (commanderAccess - 1), true);
}
subjectAccount.setRank(targetRank);
subjectAccount.setLastRankChange(new Date(System.currentTimeMillis()));
try {