diff --git a/src/main/java/org/sunbird/learner/actors/PageManagementActor.java b/src/main/java/org/sunbird/learner/actors/PageManagementActor.java index 3c98a5b88..1923862ef 100644 --- a/src/main/java/org/sunbird/learner/actors/PageManagementActor.java +++ b/src/main/java/org/sunbird/learner/actors/PageManagementActor.java @@ -201,8 +201,10 @@ private void getPageData(Request actorMessage) { String orgCode = (String) req.get(JsonKey.ORG_CODE); List> result = null; try{ + if(!ProjectUtil.isStringNullOREmpty(orgCode)){ response = cassandraOperation.getRecordsByProperty(orgDbInfo.getKeySpace(), orgDbInfo.getTableName(), JsonKey.ORG_CODE, orgCode); result = (List>) response.getResult().get(JsonKey.RESPONSE); + } }catch(Exception e){ logger.error(e.getMessage(), e); } diff --git a/src/main/java/org/sunbird/learner/actors/UserManagementActor.java b/src/main/java/org/sunbird/learner/actors/UserManagementActor.java index 6616a27cd..b70b424c7 100644 --- a/src/main/java/org/sunbird/learner/actors/UserManagementActor.java +++ b/src/main/java/org/sunbird/learner/actors/UserManagementActor.java @@ -477,7 +477,7 @@ private void processEducationInfo(Map reqMap, Map userMap, DbInfo usrDbInfo) { - String email = (String)userMap.get(JsonKey.EMAIL); + /*String email = (String)userMap.get(JsonKey.EMAIL); Response resultFrEmail = cassandraOperation.getRecordsByProperty(usrDbInfo.getKeySpace(),usrDbInfo.getTableName(),JsonKey.EMAIL,email); if(((List>)resultFrEmail.get(JsonKey.RESPONSE)).size() != 0){ Map dbusrMap = ((List>)resultFrEmail.get(JsonKey.RESPONSE)).get(0); @@ -487,7 +487,7 @@ private void checkForEmailAndUserNameUniqueness(Map userMap, DbI sender().tell(exception, self()); return; } - } + }*/ if(null != userMap.get(JsonKey.USERNAME)){ String userName = (String)userMap.get(JsonKey.USERNAME); Response resultFruserName = cassandraOperation.getRecordsByProperty(usrDbInfo.getKeySpace(),usrDbInfo.getTableName(),JsonKey.USERNAME,userName); @@ -538,7 +538,13 @@ private void createUser(Request actorMessage){ Map userMap=(Map) req.get(JsonKey.USER); boolean isSSOEnabled = Boolean.valueOf(PropertiesCache.getInstance().getProperty(JsonKey.IS_SSO_ENABLED)); - if(null != userMap.get(JsonKey.EMAIL)){ + + if(!ProjectUtil.isStringNullOREmpty((String)userMap.get(JsonKey.PROVIDER))){ + userMap.put(JsonKey.LOGIN_ID, ((String)userMap.get(JsonKey.USERNAME)+"@"+(String)userMap.get(JsonKey.PROVIDER))); + }else{ + userMap.put(JsonKey.LOGIN_ID,userMap.get(JsonKey.USERNAME)); + } + /*if(null != userMap.get(JsonKey.EMAIL)){ String email = (String)userMap.get(JsonKey.EMAIL); Response resultFrEmail = cassandraOperation.getRecordsByProperty(usrDbInfo.getKeySpace(),usrDbInfo.getTableName(),JsonKey.EMAIL,email); if(((List>)resultFrEmail.get(JsonKey.RESPONSE)).size() != 0){ @@ -546,12 +552,12 @@ private void createUser(Request actorMessage){ sender().tell(exception, self()); return; } - } - if(null != userMap.get(JsonKey.USERNAME)){ - String userName = (String)userMap.get(JsonKey.USERNAME); - Response resultFrUserName = cassandraOperation.getRecordsByProperty(usrDbInfo.getKeySpace(),usrDbInfo.getTableName(),JsonKey.USERNAME,userName); + }*/ + if(null != userMap.get(JsonKey.LOGIN_ID)){ + String loginId = (String)userMap.get(JsonKey.LOGIN_ID); + Response resultFrUserName = cassandraOperation.getRecordsByProperty(usrDbInfo.getKeySpace(),usrDbInfo.getTableName(),JsonKey.LOGIN_ID,loginId); if(((List>)resultFrUserName.get(JsonKey.RESPONSE)).size() != 0){ - ProjectCommonException exception = new ProjectCommonException(ResponseCode.userNameAlreadyExistError.getErrorCode(), ResponseCode.userNameAlreadyExistError.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode()); + ProjectCommonException exception = new ProjectCommonException(ResponseCode.userAlreadyExist.getErrorCode(), ResponseCode.userAlreadyExist.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode()); sender().tell(exception, self()); return; } @@ -578,11 +584,7 @@ private void createUser(Request actorMessage){ userMap.put(JsonKey.USER_ID,OneWayHashing.encryptVal((String)userMap.get(JsonKey.USERNAME))); userMap.put(JsonKey.ID,OneWayHashing.encryptVal((String)userMap.get(JsonKey.USERNAME))); } - if(!ProjectUtil.isStringNullOREmpty((String)userMap.get(JsonKey.PROVIDER))){ - userMap.put(JsonKey.LOGIN_ID, ((String)userMap.get(JsonKey.USERNAME)+"@"+(String)userMap.get(JsonKey.PROVIDER))); - }else{ - userMap.put(JsonKey.LOGIN_ID,userMap.get(JsonKey.USERNAME)); - } + userMap.put(JsonKey.CREATED_DATE, ProjectUtil.getFormattedDate()); userMap.put(JsonKey.STATUS, ProjectUtil.Status.ACTIVE.getValue()); if(!ProjectUtil.isStringNullOREmpty((String)userMap.get(JsonKey.PASSWORD))){ @@ -833,6 +835,8 @@ private void removeUnwanted(Map reqMap) { reqMap.remove(JsonKey.EDUCATION); reqMap.remove(JsonKey.JOB_PROFILE); reqMap.remove(JsonKey.ORGANISATION); + reqMap.remove(JsonKey.EMAIL_VERIFIED); + reqMap.remove(JsonKey.PHONE_NUMBER_VERIFIED); } /**