コード例 #1
0
ファイル: FFLocationAPI.java プロジェクト: joechen2010/LBS
 /**
  * This method registers a new administrator in the system. The authentication object must be from
  * an administrator.
  *
  * @param a the authentication object
  * @param ui the new user's information
  * @param pw the new user's password
  * @return the authentication of the registered user
  */
 public boolean newAdmin(Auth a, UserInfo ui, String pw) {
   if (!dbc.loadUser(a.getUserID()).isAdministrator()) return false;
   User u = new User(ui);
   u.setPassword(pw);
   if (dbc.newUser(u)) {
     User nu = dbc.loadUser(u.getId());
     return nu != null;
   }
   return false;
 }
コード例 #2
0
ファイル: FFLocationAPI.java プロジェクト: joechen2010/LBS
 /**
  * This method registers a new user in the system
  *
  * @param ui the new user's information
  * @param pw the new user's password
  * @return the authentication of the registered user
  */
 public Auth newUser(UserInfo ui, String pw) {
   User u = new User(ui);
   u.setPassword(pw);
   u.setAdministrator(false);
   if (dbc.newUser(u)) {
     User nu = dbc.loadUser(u.getId());
     return new SAuth(Auths.getInstance().login(nu, nu.getPassword()));
   }
   return null;
 }