Skip to content

Commit

Permalink
Moderated course check for the verified Karamyogi (#416)
Browse files Browse the repository at this point in the history
* Moderated course check for the verified Karamyogi

* Moderated course check for the verified Karamyogi application.properties change

* Moderated course check for the verified Karamyogi application code review changes
  • Loading branch information
Sahil-tarento authored Jan 9, 2024
1 parent c8702b1 commit a9f2659
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/main/java/org/sunbird/cbp/service/CbPlanServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,14 @@ public SBApiResponse getCBPlanListForUser(String userOrgId, String authTokenOrUs
String userDesignation = "";
Map<String, Object> profileDetailsMap = null;
List<Map<String, Object>> professionalDetails = null;
Boolean isVerifiedKaramyogi = false;
if (StringUtils.isNotEmpty(profileDetails)) {
profileDetailsMap = mapper.readValue(profileDetails, new TypeReference<HashMap<String, Object>>() {
});
}
if (MapUtils.isNotEmpty(profileDetailsMap)) {
professionalDetails = (List<Map<String, Object>>) profileDetailsMap.get(Constants.PROFESSIONAL_DETAILS);
isVerifiedKaramyogi = (Boolean) profileDetailsMap.get(Constants.VERIFIED_KARMAYOGI);
}
if (CollectionUtils.isNotEmpty(professionalDetails)) {
userDesignation = (String) professionalDetails.get(0).get(Constants.DESIGNATION);
Expand Down Expand Up @@ -490,7 +492,22 @@ public SBApiResponse getCBPlanListForUser(String userOrgId, String authTokenOrUs
contentDetails = contentService.readContentFromCache(courseId, null);
if (MapUtils.isNotEmpty(contentDetails)) {
if (Constants.LIVE.equalsIgnoreCase((String) contentDetails.get(Constants.STATUS))) {
courseDetailsMap.put(courseId, contentDetails);
if (courseId.contains("_rc")) {
if (isVerifiedKaramyogi != null && isVerifiedKaramyogi) {
Map<String, Object> secureSettings = (Map<String, Object>) contentDetails.get(Constants.SECURE_SETTINGS);
if (MapUtils.isNotEmpty(secureSettings)) {
List<String> secureOrganisationList = (List<String>) secureSettings.get(Constants.ORGANISATION);
if (CollectionUtils.isNotEmpty(secureOrganisationList) && secureOrganisationList.contains(userOrgId)) {
courseDetailsMap.put(courseId, contentDetails);
}
}
}
if (!courseDetailsMap.containsKey(courseId)) {
contentDetails.clear();
}
} else {
courseDetailsMap.put(courseId, contentDetails);
}
}
} else {
logger.error("Failed to read course details for Id: " + courseId);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ batch.enrolment.return.size=250
limit_for_search=250
cbplan.manual.end.date=31/3/2024
hierarchy.store.keyspace.name=dev_hierarchy_store
default.content.properties=name,identifier,competencies_v5,avgRating,primaryCategory,contentType,channel,organisation,createdFor,duration,creatorLogo,appIcon,posterImage,additionalTags,description,status
default.content.properties=name,identifier,competencies_v5,avgRating,primaryCategory,contentType,channel,organisation,createdFor,duration,creatorLogo,appIcon,posterImage,additionalTags,description,status,secureSettings
cb-plan.update.publish.authorized.roles=MDO_LEADER

karma.points.limit = 10
Expand Down

0 comments on commit a9f2659

Please sign in to comment.