Example #1
0
 static Account getAccount() {
   GlobalTx tx = VersionedDataStore.getGlobalTx();
   try {
     return tx.accounts.get(connected());
   } finally {
     tx.rollback();
   }
 }
Example #2
0
  static boolean authenticate(String username, String password) {
    GlobalTx tx = VersionedDataStore.getGlobalTx();

    try {
      return tx.accounts.containsKey(username) && tx.accounts.get(username).checkPassword(password);
    } finally {
      tx.rollback();
    }
  }
Example #3
0
  static boolean check(String profile) {
    GlobalTx tx = VersionedDataStore.getGlobalTx();

    try {
      if ("admin".equals(profile))
        return tx.accounts.containsKey(connected()) && tx.accounts.get(connected()).isAdmin();
      else return false;
    } finally {
      tx.rollback();
    }
  }