Package com.baasbox.dao

Examples of com.baasbox.dao.UserDao


      getFakeApplication(),
      new Runnable()
      {
        public void run()
        {
          UserDao dao = UserDao.getInstance();
          String sFakeUser = USER_TEST + UUID.randomUUID();
          // Prepare test user
          JsonNode node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);
          //this MUST not raise an error
          ((ObjectNode) node).put(dao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER,(JsonNode)null);
View Full Code Here


        return getUsers(criteria);
    }


  public static List<ODocument> getUsers(QueryParams criteria) throws SqlInjectionException{
    UserDao dao = UserDao.getInstance();
    return dao.get(criteria);
  }
View Full Code Here

  public static OUser getOUserByUsername(String username){
    return DbHelper.getConnection().getMetadata().getSecurity().getUser(username)
  }
 
  public static ODocument getUserProfilebyUsername(String username) throws SqlInjectionException{
    UserDao dao = UserDao.getInstance();
    ODocument userDetails=null;
    userDetails=dao.getByUserName(username);
    return userDetails;
  }
View Full Code Here

    userDetails=dao.getByUserName(username);
    return userDetails;
  }
 
  public static String getUsernameByProfile(ODocument profile) throws InvalidModelException{
    UserDao dao = UserDao.getInstance();
    dao.checkModelDocument(profile);
    return (String)((ODocument)profile.field("user")).field("name");
  }
View Full Code Here

      if (StringUtils.isEmpty(username)) throw new IllegalArgumentException("username cannot be null or empty");
      if (StringUtils.isEmpty(password)) throw new IllegalArgumentException("password cannot be null or empty");
     
      ODatabaseRecordTx db =  DbHelper.getConnection();
      ODocument profile=null;
      UserDao dao = UserDao.getInstance();
      try{
          //because we have to create an OUser record and a User Object, we need a transaction
     
            DbHelper.requestTransaction();
           
            if (role==null) profile=dao.create(username, password);
            else profile=dao.create(username, password,role);
           
            ORID userRid = ((ORID)profile.field("user")).getIdentity();
            ORole friendRole=RoleDao.createFriendRole(username);
            friendRole.getDocument().field(RoleService.FIELD_ASSIGNABLE,true);
            friendRole.getDocument().field(RoleService.FIELD_MODIFIABLE,false);
View Full Code Here

    try{
      ORole newORole=RoleDao.getRole(role);
      if (newORole==null) throw new InvalidParameterException(role + " is not a role");
      if (!RoleService.isAssignable(newORole)) throw new RoleIsNotAssignableException("Role " + role + " is not assignable");
      ORID newRole=newORole.getDocument().getIdentity();
      UserDao udao=UserDao.getInstance();
      ODocument profile=udao.getByUserName(username);
      if (profile==null) throw new InvalidParameterException(username + " is not a user");
      profile=updateProfile(profile, nonAppUserAttributes,
          privateAttributes,  friendsAttributes, appUsersAttributes);

      Set<OIdentifiable>roles=( Set<OIdentifiable>)((ODocument)profile.field("user")).field("roles");
View Full Code Here

  }
 
  public static void changePassword(String username, String newPassword) throws SqlInjectionException, UserNotFoundException, OpenTransactionException {
    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();
View Full Code Here

    }
    db.getMetadata().getSecurity().getUser(username).setPassword(newPassword).save();
  }

  public static boolean exists(String username) {
    UserDao udao=UserDao.getInstance();
    return udao.existsUserName(username);
  }
View Full Code Here

    Object listOfUser=DbHelper.genericSQLStatementExecute("select @rid,system.sso_tokens as social_network from _bb_user where system.sso_tokens is not null", new String[]{""});
    for (Object doc: (List)listOfUser){
      ODocument odoc = (ODocument)doc;
      ORID rid=odoc.field("rid");
      ODocument sn=odoc.field("social_network");
      UserDao udao= UserDao.getInstance();
      ODocument profile = udao.get(rid);
     
      ODocument registeredUserProp = profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_REGISTERED_USER);
      if (registeredUserProp==null) registeredUserProp=new ODocument(UserDao.USER_ATTRIBUTES_CLASS);
     
      Map socialdata=registeredUserProp.field("_social");
View Full Code Here

  public static List<ODocument> getFriendsOf(String username, QueryParams criteria) throws InvalidCriteriaException, SqlInjectionException {
    String friendShipRole=RoleDao.getFriendRoleName(username);
    criteria.where(getWhereFromCriteria(criteria));
    criteria.params(addFriendShipRoleToCriteria(criteria, friendShipRole));
    UserDao udao= UserDao.getInstance();
    return udao.get(criteria);
  }
View Full Code Here

TOP

Related Classes of com.baasbox.dao.UserDao

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.