Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop-pmp-revamp' into devel…
Browse files Browse the repository at this point in the history
…op-pmp-revamp
  • Loading branch information
anup-nehe committed Oct 22, 2024
2 parents 7571ec5 + e6eaa38 commit 6c564e2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ public final class PartnerConstants {
public static final String ASC = "asc";

public static final String DESC = "desc";

public static final String PARTNER_ADMIN = "PARTNER_ADMIN";
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class PartnerDetailsV3Dto {
@Schema(description = "Name of the organization the partner belongs to", example = "Org")
private String organizationName;

@Schema(description = "Contact Number of the partner", example = "8983983332")
private String contactNumber;

@Schema(description = "Name of the policy group name the partner has selected", example = "Policy123")
private String policyGroupName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ public ResponseWrapperV2<PartnerDetailsV3Dto> getPartnerDetails(String partnerId
partnerDetailsV3Dto.setPartnerType(partner.getPartnerTypeCode());
partnerDetailsV3Dto.setOrganizationName(partner.getName());
partnerDetailsV3Dto.setEmailId(partner.getEmailId());
partnerDetailsV3Dto.setContactNumber(partner.getContactNo());
if ((!partner.getPartnerTypeCode().equals(FTM_PROVIDER) &&
!partner.getPartnerTypeCode().equals(DEVICE_PROVIDER) &&
(Objects.isNull(partner.getPolicyGroupId()) || partner.getPolicyGroupId().isEmpty()))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,8 @@ protected <T> T getCertificateFromKeyMgr(PartnerCertDownloadRequestDto certDownl
}
}
T responseObject = null;
if (isPartnerBelongsToTheUser) {
boolean isAdmin = partnerHelper.isPartnerAdmin(authUserDetails().getAuthorities().toString());
if (isPartnerBelongsToTheUser || isAdmin) {
Optional<Partner> partnerFromDb = partnerRepository.findById(certDownloadRequestDto.getPartnerId());
if (partnerFromDb.isEmpty()) {
LOGGER.error("Partner not exists with id {}", certDownloadRequestDto.getPartnerId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,11 @@ public Sort getSortingRequest (String fieldName, String sortType) {
}
return sortingRequest;
}

public boolean isPartnerAdmin(String roles) {
if (roles.contains(PartnerConstants.PARTNER_ADMIN)) {
return true;
}
return false;
}
}

0 comments on commit 6c564e2

Please sign in to comment.