Package com.ikanow.infinit.e.data_model.store.social.authentication

Examples of com.ikanow.infinit.e.data_model.store.social.authentication.AuthenticationPojo.toDb()


public class AuthUtils {
  public static boolean isAdmin(ObjectId userId) {
    try {
      AuthenticationPojo authQuery = new AuthenticationPojo();
      authQuery.setProfileId(userId);
      BasicDBObject dbo = (BasicDBObject) DbManager.getSocial().getAuthentication().findOne(authQuery.toDb());
      if (null != dbo) {
        AuthenticationPojo ap = AuthenticationPojo.fromDb(dbo, AuthenticationPojo.class);
        if (null != ap.getAccountType()) {
          if (ap.getAccountType().equalsIgnoreCase("admin")) {
            return true;
View Full Code Here


public class AuthUtils {
  public static boolean isAdmin(ObjectId userId) {
    try {
      AuthenticationPojo authQuery = new AuthenticationPojo();
      authQuery.setProfileId(userId);
      BasicDBObject dbo = (BasicDBObject) DbManager.getSocial().getAuthentication().findOne(authQuery.toDb());
      if (null != dbo) {
        AuthenticationPojo ap = AuthenticationPojo.fromDb(dbo, AuthenticationPojo.class);
        if (null != ap.getAccountType()) {
          if (ap.getAccountType().equalsIgnoreCase("admin")) {
            return true;
View Full Code Here

      }
      ap.setApiKey(wpa.getApiKey());
     
      //Step 5 Save all of these objects to the DB
      DbManager.getSocial().getPerson().insert(pp.toDb());
      DbManager.getSocial().getAuthentication().insert(ap.toDb());
     
      CommunityHandler cc = new CommunityHandler();
      cc.createSelfCommunity(pp); //add user to own community
     
      //try to get system
View Full Code Here

      }
      else {
        rp.setResponse(new ResponseObject("WP Update User",false,"Internal authentication error 1"));
        return rp;       
      }
      DBObject dboauth = DbManager.getSocial().getAuthentication().findOne(authQuery.toDb());
      if (null == dboauth) {
        rp.setResponse(new ResponseObject("WP Update User",false,"Internal authentication error 2"));
        return rp;       
      }     
      AuthenticationPojo ap = AuthenticationPojo.fromDb(dboauth, AuthenticationPojo.class);
View Full Code Here

      }//TESTED
      //else if api key is null then leave alone, assume hasn't changed
     
      //update old entries
      DbManager.getSocial().getPerson().update(new BasicDBObject("_id", pp.get_id()), pp.toDb());
      DbManager.getSocial().getAuthentication().update(authQuery.toDb(), ap.toDb());     
      rp.setResponse(new ResponseObject("WP Update User",true,"User Updated Successfully"));
      rp.setData(ap, new AuthenticationPojoApiMap());
     
      //update communities if necessary
      if (bNeedToUpdateCommunities)
View Full Code Here

    //TESTED
   
    AuthenticationPojo authQuery = new AuthenticationPojo();
    if (null != authQuery.getWPUserID()) { // (Some older records have this and of course it deletes the entire auth DB...)
      authQuery.setWPUserID(pp.getWPUserID());
      DbManager.getSocial().getAuthentication().remove(authQuery.toDb());
    }
    else if (null != pp.getEmail()) {
      authQuery.setUsername(pp.getEmail());
      DbManager.getSocial().getAuthentication().remove(authQuery.toDb());
    }
View Full Code Here

      authQuery.setWPUserID(pp.getWPUserID());
      DbManager.getSocial().getAuthentication().remove(authQuery.toDb());
    }
    else if (null != pp.getEmail()) {
      authQuery.setUsername(pp.getEmail());
      DbManager.getSocial().getAuthentication().remove(authQuery.toDb());
    }
    // (else we'll just have to leave that object in there unfortunately)
    //TESTED
   
    // Delete any cookies the user might have
View Full Code Here

        }//TESTED
       
        // Get username from profile id:
        AuthenticationPojo userQuery = new AuthenticationPojo();
        userQuery.setProfileId(new ObjectId(userIdStr));
        BasicDBObject userDbo = (BasicDBObject) DbManager.getSocial().getAuthentication().findOne(userQuery.toDb());
        String userName = userIdStr;
        if (null != userDbo) {
          AuthenticationPojo user =  AuthenticationPojo.fromDb(userDbo, AuthenticationPojo.class);
          userName = user.getUsername();
        }//TESTED
View Full Code Here

      UIModulePojo oldModule = UIModulePojo.fromDb(oldModuleDbo, UIModulePojo.class);
     
      // Get username from profile id:
      AuthenticationPojo userQuery = new AuthenticationPojo();
      userQuery.setProfileId(new ObjectId(userIdStr));
      BasicDBObject userDbo = (BasicDBObject) DbManager.getSocial().getAuthentication().findOne(userQuery.toDb());       
      String userName = userIdStr;
      if (null != userDbo) {
        AuthenticationPojo user =  AuthenticationPojo.fromDb(userDbo, AuthenticationPojo.class);
        userName = user.getUsername();
      }//TOTEST
View Full Code Here

      return false;
    try
    {
      AuthenticationPojo authQuery = new AuthenticationPojo();
      authQuery.setProfileId(new ObjectId(personIdStr));
      BasicDBObject dbo = (BasicDBObject) DbManager.getSocial().getAuthentication().findOne(authQuery.toDb());
      if (null != dbo) {
        AuthenticationPojo ap = AuthenticationPojo.fromDb(dbo, AuthenticationPojo.class);     
        return adminCheck(ap, mustBeEnabled);
      }
      return false;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.