예제 #1
0
 public static void changePasswordCurrentUser(String newPassword) {
   ODatabaseRecordTx db = DbHelper.getConnection();
   String username = db.getUser().getName();
   db = DbHelper.reconnectAsAdmin();
   db.getMetadata().getSecurity().getUser(username).setPassword(newPassword).save();
   // DbHelper.removeConnectionFromPool();
 }
예제 #2
0
 public static void changePassword(String username, String newPassword)
     throws SqlInjectionException, UserNotFoundException {
   ODatabaseRecordTx db = DbHelper.getConnection();
   db = DbHelper.reconnectAsAdmin();
   UserDao udao = UserDao.getInstance();
   ODocument user = udao.getByUserName(username);
   if (user == null) {
     if (Logger.isDebugEnabled()) Logger.debug("User " + username + " does not exist");
     throw new UserNotFoundException("User " + username + " does not exist");
   }
   db.getMetadata().getSecurity().getUser(username).setPassword(newPassword).save();
 }
예제 #3
0
 /**
  * * Returns an edge (link), belonging to the class @LinkDao.MODEL_NAME, by its id (not RID)
  *
  * @param id
  * @return
  */
 public static ORID getRidLinkByUUID(String id) {
   ODatabaseRecordTx db = DbHelper.getConnection();
   OIndex<?> index = db.getMetadata().getIndexManager().getIndex(LinkDao.MODEL_NAME + ".id");
   ORID rid = (ORID) index.get(id);
   return rid;
 }