Skip to content

Commit

Permalink
Change config name to ShowLegacyRoleClaim and address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shanggeeth committed Dec 11, 2024
1 parent 1585b36 commit ba45081
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public List<LocalClaim> getLocalClaims(String tenantDomain) throws ClaimMetadata
// Add listener

boolean isGroupRoleSeparationEnabled = IdentityUtil.isGroupsVsRolesSeparationImprovementsEnabled();
boolean isShowRoleClaimOnGroupRoleSeparation = IdentityUtil.isShowRoleClaimOnGroupRoleSeparationEnabled();
boolean isShowRoleClaimOnGroupRoleSeparation = IdentityUtil.isShowLegacyRoleClaimOnGroupRoleSeparationEnabled();
List<LocalClaim> filteredLocalClaims = new ArrayList<>(localClaims.size());

for (LocalClaim claim : localClaims) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.identity.claim.metadata.mgt.exception.ClaimMetadataException;
import org.wso2.carbon.identity.claim.metadata.mgt.internal.IdentityClaimManagementServiceDataHolder;
import org.wso2.carbon.identity.claim.metadata.mgt.internal.ReadOnlyClaimMetadataManager;
import org.wso2.carbon.identity.claim.metadata.mgt.internal.ReadWriteClaimMetadataManager;
import org.wso2.carbon.identity.claim.metadata.mgt.model.ClaimDialect;
import org.wso2.carbon.identity.claim.metadata.mgt.model.ExternalClaim;
Expand Down Expand Up @@ -459,7 +458,7 @@ private boolean isFilterableClaim(LocalClaim localClaim) {
// considered as a legacy claim going forward, thus `roles` and `groups` claims should be used
// instead.
if (IdentityUtil.isGroupsVsRolesSeparationImprovementsEnabled() &&
!IdentityUtil.isShowRoleClaimOnGroupRoleSeparationEnabled() && UserCoreConstants.ROLE_CLAIM.
!IdentityUtil.isShowLegacyRoleClaimOnGroupRoleSeparationEnabled() && UserCoreConstants.ROLE_CLAIM.
equals(localClaim.getClaimURI())) {
if (log.isDebugEnabled()) {
log.debug("Skipping the legacy role claim: " + localClaim.getClaimURI() + ", when getting " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected Map<String, Object> initialValue() {
private static final String APPLICATION_DOMAIN = "Application";
private static final String WORKFLOW_DOMAIN = "Workflow";
private static Boolean groupsVsRolesSeparationImprovementsEnabled;
private static Boolean showRoleClaimOnGroupRoleSeparationEnabled;
private static Boolean showLegacyRoleClaimOnGroupRoleSeparationEnabled;
private static String JAVAX_TRANSFORMER_PROP_VAL = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";

// System Property for trust managers.
Expand Down Expand Up @@ -1634,19 +1634,20 @@ public static boolean isGroupsVsRolesSeparationImprovementsEnabled() {
*
* @return Where show role claim on group role separation enabled or not.
*/
public static boolean isShowRoleClaimOnGroupRoleSeparationEnabled() {
public static boolean isShowLegacyRoleClaimOnGroupRoleSeparationEnabled() {

try {
UserRealm userRealm = AdminServicesUtil.getUserRealm();
if(userRealm == null) {
if (userRealm == null) {
log.warn("Unable to find the user realm, thus ShowRoleClaimOnGroupRoleSeparationEnabled is set as FALSE.");
return Boolean.FALSE;
}
if (showRoleClaimOnGroupRoleSeparationEnabled == null) {
showRoleClaimOnGroupRoleSeparationEnabled = UserCoreUtil.isShowRoleClaimOnGroupRoleSeparationEnabled(
if (showLegacyRoleClaimOnGroupRoleSeparationEnabled == null) {
showLegacyRoleClaimOnGroupRoleSeparationEnabled =
UserCoreUtil.isShowLegacyRoleClaimOnGroupRoleSeparationEnabled(
userRealm.getRealmConfiguration());
}
return showRoleClaimOnGroupRoleSeparationEnabled;
return showLegacyRoleClaimOnGroupRoleSeparationEnabled;
} catch (UserStoreException | CarbonException e) {
log.warn("Property value parsing error: ShowRoleClaimOnGroupRoleSeparationEnabled, thus considered as FALSE");
return Boolean.FALSE;
Expand Down

0 comments on commit ba45081

Please sign in to comment.