diff --git a/.circleci/config.yml b/.circleci/config.yml index 1bb1be47ff..db987e5c40 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,15 +6,15 @@ jobs: steps: - checkout - restore_cache: - key: lms-dependency-cache-{{ checksum "pom.xml" }} + key: userorg-dependency-cache-{{ checksum "pom.xml" }} - run: mvn clean install - run: cd controller && mvn play2:dist - save_cache: - key: lms-dependency-cache-{{ checksum "pom.xml" }} + key: userorg-dependency-cache-{{ checksum "pom.xml" }} paths: ~/.m2 - run: name: Analyze on SonarCloud - command: mvn verify -DskipTests sonar:sonar -Dsonar.projectKey=project-sunbird_sunbird-lms-service -Dsonar.organization=project-sunbird -Dsonar.host.url=https://sonarcloud.io -Dsonar.coverage.exclusions=**/cassandra-utils/**,**/es-utils/**,**/models/**,**/model/**,**/bean/**,**/dto/**,**/bulkupload/**,**/error/**,**/exception/**,**/util/search/** -Dsonar.coverage.jacoco.xmlReportPaths=/home/circleci/project/reports/target/jacoco/jacoco.xml + command: mvn verify -DskipTests sonar:sonar -Dsonar.projectKey=Sunbird-Lern_userorg-service -Dsonar.organization=sunbird-lern -Dsonar.host.url=https://sonarcloud.io -Dsonar.coverage.exclusions=**/cassandra-utils/**,**/es-utils/**,**/models/**,**/model/**,**/bean/**,**/dto/**,**/bulkupload/**,**/error/**,**/exception/**,**/util/search/** -Dsonar.coverage.jacoco.xmlReportPaths=/home/circleci/project/reports/target/jacoco/jacoco.xml workflows: version: 2.1 diff --git a/Dockerfile b/Dockerfile index 591ec41b29..8ada708c0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,13 @@ RUN apk update \ && apk add unzip \ && apk add curl \ && adduser -u 1001 -h /home/sunbird/ -D sunbird \ - && mkdir -p /home/sunbird/learner + && mkdir -p /home/sunbird #ENV sunbird_learnerstate_actor_host 52.172.24.203 #ENV sunbird_learnerstate_actor_port 8088 RUN chown -R sunbird:sunbird /home/sunbird USER sunbird -COPY ./controller/target/learning-service-1.0-SNAPSHOT-dist.zip /home/sunbird/learner/ -RUN unzip /home/sunbird/learner/learning-service-1.0-SNAPSHOT-dist.zip -d /home/sunbird/learner/ -WORKDIR /home/sunbird/learner/ -CMD java -XX:+PrintFlagsFinal $JAVA_OPTIONS -Dplay.server.http.idleTimeout=180s -Dlog4j2.formatMsgNoLookups=true -cp '/home/sunbird/learner/learning-service-1.0-SNAPSHOT/lib/*' play.core.server.ProdServerStart /home/sunbird/learner/learning-service-1.0-SNAPSHOT +COPY ./controller/target/userorg-service-1.0-SNAPSHOT-dist.zip /home/sunbird/ +RUN unzip /home/sunbird/userorg-service-1.0-SNAPSHOT-dist.zip -d /home/sunbird/ +WORKDIR /home/sunbird/ +CMD java -XX:+PrintFlagsFinal $JAVA_OPTIONS -Dplay.server.http.idleTimeout=180s -Dlog4j2.formatMsgNoLookups=true -cp '/home/sunbird/userorg-service-1.0-SNAPSHOT/lib/*' play.core.server.ProdServerStart /home/sunbird/userorg-service-1.0-SNAPSHOT diff --git a/Dockerfile.Build b/Dockerfile.Build index 245be1eaf8..febcdfbece 100644 --- a/Dockerfile.Build +++ b/Dockerfile.Build @@ -2,14 +2,14 @@ FROM openjdk:8-jdk-alpine MAINTAINER "Manojv" "manojv@ilimi.in" WORKDIR /opt RUN apk update \ - && mkdir -p /opt/learner \ + && mkdir -p /opt/userorg \ && apk add wget \ && wget http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz \ && tar -xvzf apache-maven-3.3.9-bin.tar.gz ENV M2_HOME /opt/apache-maven-3.3.9 ENV PATH ${M2_HOME}/bin:${PATH} -COPY learner /opt/learner/ -WORKDIR /opt/learner/services +COPY userorg /opt/userorg/ +WORKDIR /opt/userorg/services RUN mvn clean install -DskipTests -WORKDIR /opt/learner/services/learning-service +WORKDIR /opt/userorg/services/userorg-service CMD ["mvn", "play2:dist"] \ No newline at end of file diff --git a/build.sh b/build.sh index 704c8b84ca..9f1ede737d 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ set -eo pipefail build_tag=$1 -name=learner_service +name=userorg-service node=$2 org=$3 diff --git a/controller/app/controllers/healthmanager/HealthController.java b/controller/app/controllers/healthmanager/HealthController.java index 0b8e8388fb..2b6cad5ef6 100644 --- a/controller/app/controllers/healthmanager/HealthController.java +++ b/controller/app/controllers/healthmanager/HealthController.java @@ -45,7 +45,7 @@ public class HealthController extends BaseController { * * @return CompletionStage */ - public CompletionStage getHealth(Http.Request httpRequest) { + public CompletionStage health(Http.Request httpRequest) { Request reqObj = new Request(); try { handleSigTerm(); @@ -72,7 +72,7 @@ public CompletionStage getHealth(Http.Request httpRequest) { * * @return CompletionStage */ - public CompletionStage getLearnerServiceHealth(String val, Http.Request httpRequest) { + public CompletionStage serviceHealth(String val, Http.Request httpRequest) { Map finalResponseMap = new HashMap<>(); List> responseList = new ArrayList<>(); Request reqObj = new Request(); @@ -99,11 +99,11 @@ public CompletionStage getLearnerServiceHealth(String val, Http.Request handleSigTerm(); responseList.add(ProjectUtil.createCheckResponse(JsonKey.LEARNER_SERVICE, false, null)); finalResponseMap.put(JsonKey.CHECKS, responseList); - finalResponseMap.put(JsonKey.NAME, "Learner service health"); + finalResponseMap.put(JsonKey.NAME, "UserOrg service health"); finalResponseMap.put(JsonKey.Healthy, true); Response response = new Response(); response.getResult().put(JsonKey.RESPONSE, finalResponseMap); - response.setId("learner.service.health.api"); + response.setId("api.userorg.service.health"); response.setVer(getApiVersion(httpRequest.path())); response.setTs(Common.getFromRequest(httpRequest, Attrs.X_REQUEST_ID)); return CompletableFuture.completedFuture(ok(play.libs.Json.toJson(response))); diff --git a/controller/conf/routes b/controller/conf/routes index f04d3598a2..009c2589eb 100644 --- a/controller/conf/routes +++ b/controller/conf/routes @@ -8,10 +8,12 @@ POST /v1/user/create @controllers.usermanagement.User POST /v2/user/create @controllers.usermanagement.UserController.createUser(request: play.mvc.Http.Request) POST /v3/user/create @controllers.usermanagement.UserController.createUser(request: play.mvc.Http.Request) POST /v1/ssouser/create @controllers.usermanagement.UserController.createSSOUser(request: play.mvc.Http.Request) + # Managed-User creation, this is not for regular user creation. POST /v4/user/create @controllers.usermanagement.UserController.createUserV4(request: play.mvc.Http.Request) POST /v1/manageduser/create @controllers.usermanagement.UserController.createManagedUser(request: play.mvc.Http.Request) POST /v2/manageduser/create @controllers.usermanagement.UserController.createManagedUser(request: play.mvc.Http.Request) + # SSU user creation POST /v1/user/signup @controllers.usermanagement.UserController.createUserV3(request: play.mvc.Http.Request) POST /v2/user/signup @controllers.usermanagement.UserController.createSSUUser(request: play.mvc.Http.Request) @@ -45,7 +47,7 @@ POST /v1/user/block @controllers.usermanagement.User POST /v1/user/unblock @controllers.usermanagement.UserStatusController.unblockUser(request: play.mvc.Http.Request) GET /v1/role/read @controllers.usermanagement.UserRoleController.getRoles(request: play.mvc.Http.Request) -GET /v1/user/role/read/:uid @controllers.usermanagement.UserRoleController.getUserRolesById(uid:String, request: play.mvc.Http.Request) +GET /v1/user/role/read/:uid @controllers.usermanagement.UserRoleController.getUserRolesById(uid:String, request: play.mvc.Http.Request) POST /v1/user/assign/role @controllers.usermanagement.UserRoleController.assignRoles(request: play.mvc.Http.Request) POST /private/user/v1/assign/role @controllers.usermanagement.UserRoleController.assignRoles(request: play.mvc.Http.Request) POST /v2/user/assign/role @controllers.usermanagement.UserRoleController.assignRolesV2(request: play.mvc.Http.Request) @@ -109,8 +111,8 @@ PATCH /v1/org/assign/key @controllers.organisationmanagem PATCH /v1/org/update/encryptionkey @controllers.organisationmanagement.OrgController.addKey(request: play.mvc.Http.Request) #Health check -GET /health @controllers.healthmanager.HealthController.getHealth(request: play.mvc.Http.Request) -GET /:service/health @controllers.healthmanager.HealthController.getLearnerServiceHealth(service:String, request: play.mvc.Http.Request) +GET /health @controllers.healthmanager.HealthController.health(request: play.mvc.Http.Request) +GET /:service/health @controllers.healthmanager.HealthController.serviceHealth(service:String, request: play.mvc.Http.Request) #Notes API POST /v1/note/create @controllers.notesmanagement.NotesController.createNote(request: play.mvc.Http.Request) diff --git a/controller/pom.xml b/controller/pom.xml index a07e9a1f31..ba0d5c375b 100644 --- a/controller/pom.xml +++ b/controller/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.sunbird - lms-service + userorg-service 1.0-SNAPSHOT 4.0.0 @@ -249,7 +249,7 @@ - learning-service-${version} + userorg-service-${version} ${basedir}/app ${basedir}/test diff --git a/controller/test/controllers/sync/SyncControllerTest.java b/controller/test/controllers/sync/SyncControllerTest.java index dfb03ae5a9..fc29916654 100644 --- a/controller/test/controllers/sync/SyncControllerTest.java +++ b/controller/test/controllers/sync/SyncControllerTest.java @@ -61,7 +61,7 @@ public void testsync() { Map requestMap = new HashMap<>(); Map innerMap = new HashMap<>(); innerMap.put(JsonKey.OBJECT_TYPE, JsonKey.ORGANISATION); - innerMap.put(JsonKey.OPERATION_FOR, "learner"); + innerMap.put(JsonKey.OPERATION_FOR, "userorg"); requestMap.put(JsonKey.REQUEST, innerMap); String data = mapToJson(requestMap); diff --git a/core/platform-common/src/main/java/org/sunbird/auth/verifier/AccessTokenValidator.java b/core/platform-common/src/main/java/org/sunbird/auth/verifier/AccessTokenValidator.java index 2adf0b8672..973b872a82 100755 --- a/core/platform-common/src/main/java/org/sunbird/auth/verifier/AccessTokenValidator.java +++ b/core/platform-common/src/main/java/org/sunbird/auth/verifier/AccessTokenValidator.java @@ -100,7 +100,7 @@ public static String verifyUserToken(String token, Map requestCo try { Map payload = validateToken(token, requestContext); logger.debug( - "learner access token validateToken() :" + "userorg access token validateToken() :" + payload.toString() + ", request context data : " + requestContext); @@ -135,7 +135,7 @@ public static String verifySourceUserToken( try { Map payload = validateToken(token, requestContext); logger.debug( - "learner source access token validateToken() :" + "userorg source access token validateToken() :" + payload.toString() + ", request context data : " + requestContext); diff --git a/core/platform-common/src/main/java/org/sunbird/keys/JsonKey.java b/core/platform-common/src/main/java/org/sunbird/keys/JsonKey.java index e72c1eb09f..5805d83e07 100644 --- a/core/platform-common/src/main/java/org/sunbird/keys/JsonKey.java +++ b/core/platform-common/src/main/java/org/sunbird/keys/JsonKey.java @@ -131,7 +131,7 @@ public final class JsonKey { public static final String LANGUAGE = "language"; public static final String LAST_LOGIN_TIME = "lastLoginTime"; public static final String LAST_NAME = "lastName"; - public static final String LEARNER_SERVICE = "Learner service"; + public static final String LEARNER_SERVICE = "UserOrg service"; public static final String LEVEL = "level"; public static final String LIMIT = "limit"; public static final String LIST = "List"; diff --git a/core/platform-common/src/main/java/org/sunbird/operations/ActorOperations.java b/core/platform-common/src/main/java/org/sunbird/operations/ActorOperations.java index 7a0c477cb5..ae578fb9af 100644 --- a/core/platform-common/src/main/java/org/sunbird/operations/ActorOperations.java +++ b/core/platform-common/src/main/java/org/sunbird/operations/ActorOperations.java @@ -1,191 +1,191 @@ package org.sunbird.operations; +import org.apache.commons.lang3.StringUtils; + import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang3.StringUtils; /** - * This enum will contains different operation for a learner {addCourse, getCourse, update , + * This enum will contain different operation for a userorg {addCourse, getCourse, update , * getContent} * * @author Manzarul */ public enum ActorOperations { - CREATE_USER("createUser", "USRCRT"), - CREATE_SSO_USER("createSSOUser", "USRCRT"), - - UPDATE_USER("updateUser", "USRUPD"), - UPDATE_USER_V2("updateUserV2", "USRUPD"), - UPDATE_USER_V3("updateUserV3", "USRUPD"), - - GET_USER_PROFILE_V3("getUserProfileV3", "USRRED"), - GET_USER_PROFILE_V4("getUserProfileV4", "USRRED"), - GET_USER_PROFILE_V5("getUserProfileV5", "USRRED"), - - UPDATE_USER_INFO_ELASTIC("updateUserInfoToElastic", "UBKGUPD"), - - GET_ROLES("getRoles", "ROLERED"), - - GET_USER_DETAILS_BY_LOGINID("getUserDetailsByLoginId", "USRRED"), - GET_USER_BY_KEY("getUserByKey", "USRRED"), - BLOCK_USER("blockUser", "USRBLOK"), - BULK_UPLOAD("bulkUpload", "BLKUPLD"), - PROCESS_BULK_UPLOAD("processBulkUpload", "BLKUPLD"), - ASSIGN_ROLES("assignRoles", "ROLUPD"), - ASSIGN_ROLES_V2("assignRolesV2", "ROLUPD"), - UNBLOCK_USER("unblockUser", "USRUNBLOK"), - - UPDATE_USER_ORG_ES("updateUserOrgES", "UOBKGUPD"), - UPDATE_USER_ROLES_ES("updateUserRoles", "UBKGROLUPD"), - SYNC("sync", "ESSYNC"), - BACKGROUND_SYNC("backgroundSync", "BKGESSYNC"), - EMAIL_SERVICE("emailService", "EMAILNOTI"), - FILE_STORAGE_SERVICE("fileStorageService", "STRGSER"), - HEALTH_CHECK("healthCheck", "HLTHCHK"), - SEND_MAIL("sendMail", "NOTI"), - ACTOR("actor", "HLTHCHK"), - CASSANDRA("cassandra", "HLTHCHK"), - ES("es", "HLTHCHK"), - EKSTEP("ekstep", "HLTHCHK"), - - CREATE_NOTE("createNote", "NOTECRT"), - UPDATE_NOTE("updateNote", "NOTEUPD"), - SEARCH_NOTE("searchNote", "NOTESER"), - GET_NOTE("getNote", "NOTERED"), - DELETE_NOTE("deleteNote", "NOTEDEL"), - - INSERT_USER_NOTES_ES("insertUserNotesToElastic", "NBKGCRT"), - UPDATE_USER_NOTES_ES("updateUserNotesToElastic", "NBKGUPD"), - - CREATE_TENANT_PREFERENCE("createTenantPreference", "TPREFCRT"), - UPDATE_TENANT_PREFERENCE("updateTenantPreference", "TPREFUPD"), - GET_TENANT_PREFERENCE("getTenantPreference", "TPREFRED"), - // REG_CHANNEL("channelReg", "CHNLREG"), - - UPDATE_SYSTEM_SETTINGS("updateSystemSettings", "SYSUPD"), - GET_SYSTEM_SETTING("getSystemSetting", "SYSRED"), - GET_ALL_SYSTEM_SETTINGS("getAllSystemSettings", "SYSRED"), - SET_SYSTEM_SETTING("setSystemSetting", "SYSCRT"), - - USER_TNC_ACCEPT("userTnCAccept", "TNCACCPT"), - - GENERATE_OTP("generateOTP", "OTPCRT"), - VERIFY_OTP("verifyOTP", "OTPVERFY"), - SEND_OTP("sendOTP", "OTPNOTI"), - - GET_USER_TYPES("getUserTypes", "UTYPRED"), - - USER_TENANT_MIGRATE("userTenantMigrate", "USRMIG"), - FREEUP_USER_IDENTITY("freeUpUserIdentity", "IDNTFREE"), - RESET_PASSWORD("resetPassword", "PASSRST"), - MERGE_USER("mergeUser", "USRMRG"), - MERGE_USER_TO_ELASTIC("mergeUserToElastic", "UBKGMRG"), - - MERGE_USER_CERTIFICATE("mergeUserCertificate", "USRCRTMRG"), - USER_SELF_DECLARED_TENANT_MIGRATE("userSelfDeclaredTenantMigrate", "USDTMIG"), - // REJECT_MIGRATION("rejectMigration", "UMIGREJ"), - - GET_USER_FEED_BY_ID("getUserFeedById", "FEEDRED"), - CREATE_USER_FEED("createUserFeed", "FEEDCRT"), - DELETE_USER_FEED("deleteUserFeed", "FEEDDEL"), - UPDATE_USER_FEED("updateUserFeed", "FEEDUPD"), - - CREATE_USER_V3("createUserV3", "USRCRT"), - CREATE_SSU_USER("createSSUUser", "USRCRT"), - CREATE_USER_V4("createUserV4", "USRCRT"), - CREATE_MANAGED_USER("createManagedUser", "USRCRT"), - - V2_NOTIFICATION("v2Notification", "NOTI"), - GET_MANAGED_USERS("getManagedUsers", "USRRED"), - CHECK_USER_EXISTENCE("checkUserExistence", "UEXIST"), - CHECK_USER_EXISTENCEV2("checkUserExistenceV2", "UEXIST"), - UPDATE_USER_DECLARATIONS("updateUserDeclarations", "UDECLUPD"), - UPDATE_USER_CONSENT("updateUserConsent", "UCNSNTUPD"), - - USER_SEARCH("userSearch", "USRSER"), - USER_SEARCH_V2("userSearchV2", "USRSER"), - USER_SEARCH_V3("userSearchV3", "USRSER"), - ORG_SEARCH("orgSearch", "ORGSER"), - ORG_SEARCH_V2("orgSearchV2", "ORGSER"), - USER_LOOKUP("userLookup", "USRLKP"), - GET_USER_CONSENT("getUserConsent", "UCNSTRED"), - GET_USER_ROLES_BY_ID("getUserRolesById", "UROLERED"), - // UserActorOperations - INSERT_USER_ORG_DETAILS("insertUserOrgDetails", "UOBKGCRT"), - UPDATE_USER_ORG_DETAILS("updateUserOrgDetails", "UOBKGUPD"), - - UPSERT_USER_EXTERNAL_IDENTITY_DETAILS("upsertUserExternalIdentityDetails", "UEXTIDUPSRT"), - PROCESS_ONBOARDING_MAIL_AND_SMS("processOnBoardingMailAndSms", "WLCMNOTI"), - PROCESS_PASSWORD_RESET_MAIL_AND_SMS("processPasswordResetMailAndSms", "PASSNOTI"), - SAVE_USER_ATTRIBUTES("saveUserAttributes", "UATTRUPSRT"), - UPSERT_USER_DETAILS_TO_ES("upsertUserDetailsToES", "UBKGUPSRT"), - UPSERT_USER_ORG_DETAILS_TO_ES("upsertUserOrgDetailsToES", "UOBKGUPSRT"), - UPSERT_USER_SELF_DECLARATIONS("upsertUserSelfDeclarations", "USDUPSRT"), - UPDATE_USER_SELF_DECLARATIONS_ERROR_TYPE("updateUserSelfDeclarationsErrorType", "USDETUPD"), - LOCATION_BULK_UPLOAD("locationBulkUpload", "LOCUPLD"), - LOCATION_BULK_UPLOAD_BACKGROUND_JOB("locationBulkUploadBackground", "LBKGUPLD"), - GET_BULK_OP_STATUS("getBulkOpStatus", "BLKSTSRED"), - ORG_BULK_UPLOAD("orgBulkUpload", "ORGUPLD"), - ORG_BULK_UPLOAD_BACKGROUND_JOB("orgBulkUploadBackground", "OBKGUPLD"), - - USER_BULK_UPLOAD("userBulkUpload", "USRUPLD"), - USER_BULK_UPLOAD_BACKGROUND_JOB("userBulkUploadBackground", "UBKGUPLD"), - - CREATE_ORG("createOrg", "ORGCRT"), - UPDATE_ORG("updateOrg", "ORGUPD"), - UPDATE_ORG_STATUS("updateOrgStatus", "OSTSUPD"), - GET_ORG_DETAILS("getOrgDetails", "ORGRED"), - ASSIGN_KEYS("assignKeys", "ASSGNK"), - UPSERT_ORGANISATION_TO_ES("upsertOrganisationDataToES", "OBKGUPSRT"), - // Location Actor Operations - CREATE_LOCATION("createLocation", "LOCCRT"), - UPDATE_LOCATION("updateLocation", "LOCUPD"), - SEARCH_LOCATION("searchLocation", "LOCSER"), - DELETE_LOCATION("deleteLocation", "LOCDEL"), - GET_RELATED_LOCATION_IDS("getRelatedLocationIds", "LOCRED"), - READ_LOCATION_TYPE("readLocationType", "LOCTYPRED"), - UPSERT_LOCATION_TO_ES("upsertLocationDataToES", "LBKGUPSRT"), - DELETE_LOCATION_FROM_ES("deleteLocationDataFromES", "LBKGDEL"), - ADD_ENCRYPTION_KEY("addEncryptionKey", "ADENCKEY"), - USER_CURRENT_LOGIN("userCurrentLogin", "USRLOG"); - - - private String value; - - private String operationCode; - - public String getOperationCode() { - return operationCode; - } - - ActorOperations(String value, String operationCode) { - this.value = value; - this.operationCode = operationCode; - } - - /** - * returns the enum value - * - * @return String - */ - public String getValue() { - return this.value; - } - - private static final Map opCodeByActorOption = new HashMap<>(); - - static { - for (ActorOperations actorOperation : values()) { - opCodeByActorOption.put(actorOperation.getValue(), actorOperation.getOperationCode()); + CREATE_USER("createUser", "USRCRT"), + CREATE_SSO_USER("createSSOUser", "USRCRT"), + + UPDATE_USER("updateUser", "USRUPD"), + UPDATE_USER_V2("updateUserV2", "USRUPD"), + UPDATE_USER_V3("updateUserV3", "USRUPD"), + + GET_USER_PROFILE_V3("getUserProfileV3", "USRRED"), + GET_USER_PROFILE_V4("getUserProfileV4", "USRRED"), + GET_USER_PROFILE_V5("getUserProfileV5", "USRRED"), + + UPDATE_USER_INFO_ELASTIC("updateUserInfoToElastic", "UBKGUPD"), + + GET_ROLES("getRoles", "ROLERED"), + + GET_USER_DETAILS_BY_LOGINID("getUserDetailsByLoginId", "USRRED"), + GET_USER_BY_KEY("getUserByKey", "USRRED"), + BLOCK_USER("blockUser", "USRBLOK"), + BULK_UPLOAD("bulkUpload", "BLKUPLD"), + PROCESS_BULK_UPLOAD("processBulkUpload", "BLKUPLD"), + ASSIGN_ROLES("assignRoles", "ROLUPD"), + ASSIGN_ROLES_V2("assignRolesV2", "ROLUPD"), + UNBLOCK_USER("unblockUser", "USRUNBLOK"), + + UPDATE_USER_ORG_ES("updateUserOrgES", "UOBKGUPD"), + UPDATE_USER_ROLES_ES("updateUserRoles", "UBKGROLUPD"), + SYNC("sync", "ESSYNC"), + BACKGROUND_SYNC("backgroundSync", "BKGESSYNC"), + EMAIL_SERVICE("emailService", "EMAILNOTI"), + FILE_STORAGE_SERVICE("fileStorageService", "STRGSER"), + HEALTH_CHECK("healthCheck", "HLTHCHK"), + SEND_MAIL("sendMail", "NOTI"), + ACTOR("actor", "HLTHCHK"), + CASSANDRA("cassandra", "HLTHCHK"), + ES("es", "HLTHCHK"), + EKSTEP("ekstep", "HLTHCHK"), + + CREATE_NOTE("createNote", "NOTECRT"), + UPDATE_NOTE("updateNote", "NOTEUPD"), + SEARCH_NOTE("searchNote", "NOTESER"), + GET_NOTE("getNote", "NOTERED"), + DELETE_NOTE("deleteNote", "NOTEDEL"), + + INSERT_USER_NOTES_ES("insertUserNotesToElastic", "NBKGCRT"), + UPDATE_USER_NOTES_ES("updateUserNotesToElastic", "NBKGUPD"), + + CREATE_TENANT_PREFERENCE("createTenantPreference", "TPREFCRT"), + UPDATE_TENANT_PREFERENCE("updateTenantPreference", "TPREFUPD"), + GET_TENANT_PREFERENCE("getTenantPreference", "TPREFRED"), + // REG_CHANNEL("channelReg", "CHNLREG"), + + UPDATE_SYSTEM_SETTINGS("updateSystemSettings", "SYSUPD"), + GET_SYSTEM_SETTING("getSystemSetting", "SYSRED"), + GET_ALL_SYSTEM_SETTINGS("getAllSystemSettings", "SYSRED"), + SET_SYSTEM_SETTING("setSystemSetting", "SYSCRT"), + + USER_TNC_ACCEPT("userTnCAccept", "TNCACCPT"), + + GENERATE_OTP("generateOTP", "OTPCRT"), + VERIFY_OTP("verifyOTP", "OTPVERFY"), + SEND_OTP("sendOTP", "OTPNOTI"), + + GET_USER_TYPES("getUserTypes", "UTYPRED"), + + USER_TENANT_MIGRATE("userTenantMigrate", "USRMIG"), + FREEUP_USER_IDENTITY("freeUpUserIdentity", "IDNTFREE"), + RESET_PASSWORD("resetPassword", "PASSRST"), + MERGE_USER("mergeUser", "USRMRG"), + MERGE_USER_TO_ELASTIC("mergeUserToElastic", "UBKGMRG"), + + MERGE_USER_CERTIFICATE("mergeUserCertificate", "USRCRTMRG"), + USER_SELF_DECLARED_TENANT_MIGRATE("userSelfDeclaredTenantMigrate", "USDTMIG"), + // REJECT_MIGRATION("rejectMigration", "UMIGREJ"), + + GET_USER_FEED_BY_ID("getUserFeedById", "FEEDRED"), + CREATE_USER_FEED("createUserFeed", "FEEDCRT"), + DELETE_USER_FEED("deleteUserFeed", "FEEDDEL"), + UPDATE_USER_FEED("updateUserFeed", "FEEDUPD"), + + CREATE_USER_V3("createUserV3", "USRCRT"), + CREATE_SSU_USER("createSSUUser", "USRCRT"), + CREATE_USER_V4("createUserV4", "USRCRT"), + CREATE_MANAGED_USER("createManagedUser", "USRCRT"), + + V2_NOTIFICATION("v2Notification", "NOTI"), + GET_MANAGED_USERS("getManagedUsers", "USRRED"), + CHECK_USER_EXISTENCE("checkUserExistence", "UEXIST"), + CHECK_USER_EXISTENCEV2("checkUserExistenceV2", "UEXIST"), + UPDATE_USER_DECLARATIONS("updateUserDeclarations", "UDECLUPD"), + UPDATE_USER_CONSENT("updateUserConsent", "UCNSNTUPD"), + + USER_SEARCH("userSearch", "USRSER"), + USER_SEARCH_V2("userSearchV2", "USRSER"), + USER_SEARCH_V3("userSearchV3", "USRSER"), + ORG_SEARCH("orgSearch", "ORGSER"), + ORG_SEARCH_V2("orgSearchV2", "ORGSER"), + USER_LOOKUP("userLookup", "USRLKP"), + GET_USER_CONSENT("getUserConsent", "UCNSTRED"), + GET_USER_ROLES_BY_ID("getUserRolesById", "UROLERED"), + // UserActorOperations + INSERT_USER_ORG_DETAILS("insertUserOrgDetails", "UOBKGCRT"), + UPDATE_USER_ORG_DETAILS("updateUserOrgDetails", "UOBKGUPD"), + + UPSERT_USER_EXTERNAL_IDENTITY_DETAILS("upsertUserExternalIdentityDetails", "UEXTIDUPSRT"), + PROCESS_ONBOARDING_MAIL_AND_SMS("processOnBoardingMailAndSms", "WLCMNOTI"), + PROCESS_PASSWORD_RESET_MAIL_AND_SMS("processPasswordResetMailAndSms", "PASSNOTI"), + SAVE_USER_ATTRIBUTES("saveUserAttributes", "UATTRUPSRT"), + UPSERT_USER_DETAILS_TO_ES("upsertUserDetailsToES", "UBKGUPSRT"), + UPSERT_USER_ORG_DETAILS_TO_ES("upsertUserOrgDetailsToES", "UOBKGUPSRT"), + UPSERT_USER_SELF_DECLARATIONS("upsertUserSelfDeclarations", "USDUPSRT"), + UPDATE_USER_SELF_DECLARATIONS_ERROR_TYPE("updateUserSelfDeclarationsErrorType", "USDETUPD"), + LOCATION_BULK_UPLOAD("locationBulkUpload", "LOCUPLD"), + LOCATION_BULK_UPLOAD_BACKGROUND_JOB("locationBulkUploadBackground", "LBKGUPLD"), + GET_BULK_OP_STATUS("getBulkOpStatus", "BLKSTSRED"), + ORG_BULK_UPLOAD("orgBulkUpload", "ORGUPLD"), + ORG_BULK_UPLOAD_BACKGROUND_JOB("orgBulkUploadBackground", "OBKGUPLD"), + + USER_BULK_UPLOAD("userBulkUpload", "USRUPLD"), + USER_BULK_UPLOAD_BACKGROUND_JOB("userBulkUploadBackground", "UBKGUPLD"), + + CREATE_ORG("createOrg", "ORGCRT"), + UPDATE_ORG("updateOrg", "ORGUPD"), + UPDATE_ORG_STATUS("updateOrgStatus", "OSTSUPD"), + GET_ORG_DETAILS("getOrgDetails", "ORGRED"), + ASSIGN_KEYS("assignKeys", "ASSGNK"), + UPSERT_ORGANISATION_TO_ES("upsertOrganisationDataToES", "OBKGUPSRT"), + // Location Actor Operations + CREATE_LOCATION("createLocation", "LOCCRT"), + UPDATE_LOCATION("updateLocation", "LOCUPD"), + SEARCH_LOCATION("searchLocation", "LOCSER"), + DELETE_LOCATION("deleteLocation", "LOCDEL"), + GET_RELATED_LOCATION_IDS("getRelatedLocationIds", "LOCRED"), + READ_LOCATION_TYPE("readLocationType", "LOCTYPRED"), + UPSERT_LOCATION_TO_ES("upsertLocationDataToES", "LBKGUPSRT"), + DELETE_LOCATION_FROM_ES("deleteLocationDataFromES", "LBKGDEL"), + ADD_ENCRYPTION_KEY("addEncryptionKey", "ADENCKEY"), + USER_CURRENT_LOGIN("userCurrentLogin", "USRLOG"); + + private String value; + + private String operationCode; + + public String getOperationCode() { + return operationCode; } - } - - public static String getOperationCodeByActorOperation(String actorOperation) { - String opCode = opCodeByActorOption.get(actorOperation); - if (StringUtils.isNotBlank(opCode)) { - return opCode; - } else { - return ""; + + ActorOperations(String value, String operationCode) { + this.value = value; + this.operationCode = operationCode; + } + + /** + * returns the enum value + * + * @return String + */ + public String getValue() { + return this.value; + } + + private static final Map opCodeByActorOption = new HashMap<>(); + + static { + for (ActorOperations actorOperation : values()) { + opCodeByActorOption.put(actorOperation.getValue(), actorOperation.getOperationCode()); + } + } + + public static String getOperationCodeByActorOperation(String actorOperation) { + String opCode = opCodeByActorOption.get(actorOperation); + if (StringUtils.isNotBlank(opCode)) { + return opCode; + } else { + return ""; + } } - } } diff --git a/core/platform-common/src/test/java/org/sunbird/util/ProjectUtilTest.java b/core/platform-common/src/test/java/org/sunbird/util/ProjectUtilTest.java index 70c0c76d39..dc222e6a70 100644 --- a/core/platform-common/src/test/java/org/sunbird/util/ProjectUtilTest.java +++ b/core/platform-common/src/test/java/org/sunbird/util/ProjectUtilTest.java @@ -82,7 +82,7 @@ public void testGetContextSuccessWithOrgImageUrl() { @Test public void testCreateCheckResponseSuccess() { - Map responseMap = ProjectUtil.createCheckResponse("LearnerService", false, null); + Map responseMap = ProjectUtil.createCheckResponse("UserOrgService", false, null); assertEquals(true, responseMap.get(JsonKey.Healthy)); } @@ -90,7 +90,7 @@ public void testCreateCheckResponseSuccess() { public void testCreateCheckResponseFailureWithException() { Map responseMap = ProjectUtil.createCheckResponse( - "LearnerService", + "UserOrgService", true, new ProjectCommonException( ResponseCode.invalidObjectType, diff --git a/core/pom.xml b/core/pom.xml index 799cf9392a..ded6cabc37 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - lms-service + userorg-service org.sunbird 1.0-SNAPSHOT diff --git a/metadata.sh b/metadata.sh index f8b89b2f5b..d32ccfece8 100755 --- a/metadata.sh +++ b/metadata.sh @@ -1,3 +1,3 @@ #!/bin/sh # return version -echo '{"name":"learner_service","version":"1.15.0","org":"sunbird","hubuser":"purplesunbird"}' +echo '{"name":"userorg-service","version":"1.15.0","org":"sunbird","hubuser":"purplesunbird"}' diff --git a/pom.xml b/pom.xml index 8fbc8805fc..c84980b4ae 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.sunbird - lms-service + userorg-service 1.0-SNAPSHOT pom diff --git a/reports/pom.xml b/reports/pom.xml index 1329fd183d..82d99b03bc 100644 --- a/reports/pom.xml +++ b/reports/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - lms-service + userorg-service org.sunbird 1.0-SNAPSHOT @@ -15,7 +15,7 @@ 4.0.0 reports - LMS Aggregate Report + UserOrg Aggregate Report diff --git a/service/pom.xml b/service/pom.xml index f0bed7b093..21c278aef6 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - lms-service + userorg-service org.sunbird 1.0-SNAPSHOT diff --git a/setup.md b/setup.md index 2f072deeb3..174bf1cc62 100644 --- a/setup.md +++ b/setup.md @@ -14,7 +14,7 @@ 9. sunbird_sso_client_secret : keycloak client secret (not mandatory) 10. sunbird_valid_badge_subtypes: list of valid badge subtypes (comma separated) 11. sunbird_valid_badge_roles: list of valid badge roles (comma separated) - 12. sunbird_learner_service_url: url for learner service + 12. sunbird_learner_service_url: url for userorg service ## Do the below env setup , if you are planing to run actor as local mode. 1. sunbird_cassandra_host: host running the cassandra server 2. sunbird_cassandra_port: port on which cassandra server is running @@ -23,8 +23,8 @@ 5. sunbird_es_host: host running the elasticsearch server 6. sunbird_es_port: port on which elasticsearch server is running 7. sunbird_es_cluster (optional): name of the elasticsearch cluster - 8. sunbird_learner_actor_host: host running for learner actor - 9. sunbird_learner_actor_port: port on which learner actor is running. + 8. sunbird_learner_actor_host: host running for userorg actor + 9. sunbird_learner_actor_port: port on which userorg actor is running. 10. ekstep_content_search_base_url : provide base url for EkStep content search 11. ekstep_authorization : provide authorization for value for content search 12. sunbird_pg_host: postgres host name or ip @@ -69,8 +69,8 @@ 51.telemetry_pdata_ver=1.5 ## Do the below env setup , if you are planing to run background actor in remote mode. - 1. sunbird_background_actor_host: host running for learner background actor - 2. sunbird_background_actor_port: port on which learner background actor is running. + 1. sunbird_background_actor_host: host running for userorg background actor + 2. sunbird_background_actor_port: port on which userorg background actor is running. ## Do the below env setup , to start a actor system on a machine {"RemoteMiddlewareActorSystem" it will start Normal Actor System on that machine, ##"BackGroundRemoteMiddlewareActorSystem" , it will start background actor}. @@ -80,7 +80,7 @@ 1. Run "git submodule foreach git pull origin master" to pull the latest sunbird-common submodule. 2. Run "mvn clean install" to build the services. 2. Go to "controller" and run the command "mvn play2:dist" to generate the dist file for controller. -3. The build file "controller-1.0-SNAPSHOT-dist.zip" is generated in "sunbird-lms-service/controller/target" folder. +3. The build file "controller-1.0-SNAPSHOT-dist.zip" is generated in "userorg-service/controller/target" folder. ## Run 1. Unzip the dist file "controller-1.0-SNAPSHOT-dist.zip".