-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify the core to support removing the necessity of having role_org-application association #5619
Conversation
Hasanthi Dissanayake seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
...on/src/main/java/org/wso2/carbon/identity/application/common/model/ApplicationBasicInfo.java
Show resolved
Hide resolved
* Get application uuid. | ||
* @return uuid application uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Get application uuid. | |
* @return uuid application uuid | |
* Get application uuid. | |
* | |
* @return uuid application uuid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check formatting in other places as well
...mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationManagementService.java
Show resolved
Hide resolved
....mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java
Show resolved
Hide resolved
@@ -78,6 +78,15 @@ public class ApplicationMgtDBQueries { | |||
"TENANT_ID = ? AND APP_NAME != ? ORDER BY ID DESC"; | |||
public static final String LOAD_APP_NAMES_BY_TENANT_AND_APP_NAME = "SELECT ID, APP_NAME, DESCRIPTION FROM SP_APP " + | |||
"WHERE TENANT_ID = ? AND APP_NAME != ? AND (%s) ORDER BY ID DESC"; | |||
|
|||
public static final String LOAD_APP_IDS_BY_SP_PROPERTY_H2 = "SELECT SP_APP.UUID FROM SP_APP JOIN " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static final String LOAD_APP_IDS_BY_SP_PROPERTY_H2 = "SELECT SP_APP.UUID FROM SP_APP JOIN " + | |
public static final String LOAD_APP_IDS_BY_SP_PROPERTY_H2 = "SELECT SP_APP.UUID FROM SP_APP JOIN " + |
"SP_METADATA ON SP_APP.ID = SP_METADATA.SP_ID WHERE SP_METADATA.NAME=? and " + | ||
"SP_METADATA.`VALUE`=? AND SP_METADATA.TENANT_ID = ?"; | ||
|
||
public static final String LOAD_APP_IDS_BY_SP_PROPERTY = "SELECT SP_APP.UUID FROM SP_APP JOIN " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static final String LOAD_APP_IDS_BY_SP_PROPERTY = "SELECT SP_APP.UUID FROM SP_APP JOIN " + | |
public static final String LOAD_APP_IDS_BY_SP_PROPERTY = "SELECT SP_APP.UUID FROM SP_APP JOIN " + |
* @param key Name of the sp metadata property key | ||
* @param value Value of the sp metadata property | ||
* @return ApplicationBasicInfo containing the basic app information | ||
* @throws IdentityApplicationManagementException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complete the exception description
@@ -193,6 +195,8 @@ public class ApplicationDAOImpl extends AbstractApplicationDAOImpl implements Pa | |||
|
|||
private static final String SP_PROPERTY_NAME_CERTIFICATE = "CERTIFICATE"; | |||
private static final String APPLICATION_NAME_CONSTRAINT = "APPLICATION_NAME_CONSTRAINT"; | |||
public static final String AUDIENCE_EQ_ORGANIZATION = "audience eq organization"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we build this filter value by combining existing constants for audience, eq and organization separately
List<RoleBasicInfo> listOfAllRoles = roleManagementServiceV2.getRoles(AUDIENCE_EQ_ORGANIZATION, | ||
0, 0, null, null, tenantDomain); | ||
List<String> roleIds = listOfAllRoles.stream().map(RoleBasicInfo::getId).collect(Collectors.toList()); | ||
associatedRolesConfig.setRoles(buildAssociatedRolesWithRoleName(roleIds, tenantDomain)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we returning all organization audienced roles as the associated roles, if the app is using organization audienced roles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
* @return | ||
* @throws IdentityApplicationManagementException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complete
|
||
int tenantID = CarbonContext.getThreadLocalCarbonContext().getTenantId(); | ||
if (log.isDebugEnabled()) { | ||
log.debug("Getting the all applications for the tenant: " + tenantID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.debug("Getting the all applications for the tenant: " + tenantID); | |
log.debug(String.format("Getting the all applications matching to property: %s value equals to %s in the tenant: %d", key, value, tenantID); |
ResultSet appNameResultSet = null; | ||
ArrayList<ApplicationBasicInfo> appInfo = new ArrayList<ApplicationBasicInfo>(); | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use try with resource, making connection and preparedStatement resources which auto closable at the end of usage?
@@ -78,6 +78,15 @@ public class ApplicationMgtDBQueries { | |||
"TENANT_ID = ? AND APP_NAME != ? ORDER BY ID DESC"; | |||
public static final String LOAD_APP_NAMES_BY_TENANT_AND_APP_NAME = "SELECT ID, APP_NAME, DESCRIPTION FROM SP_APP " + | |||
"WHERE TENANT_ID = ? AND APP_NAME != ? AND (%s) ORDER BY ID DESC"; | |||
|
|||
public static final String LOAD_APP_IDS_BY_SP_PROPERTY_H2 = "SELECT SP_APP.UUID FROM SP_APP JOIN " + | |||
"SP_METADATA ON SP_APP.ID = SP_METADATA.SP_ID WHERE SP_METADATA.NAME=? and " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"SP_METADATA ON SP_APP.ID = SP_METADATA.SP_ID WHERE SP_METADATA.NAME=? and " + | |
"SP_METADATA ON SP_APP.ID = SP_METADATA.SP_ID WHERE SP_METADATA.NAME=? and " + |
"SP_METADATA.`VALUE`=? AND SP_METADATA.TENANT_ID = ?"; | ||
|
||
public static final String LOAD_APP_IDS_BY_SP_PROPERTY = "SELECT SP_APP.UUID FROM SP_APP JOIN " + | ||
"SP_METADATA ON SP_APP.ID = SP_METADATA.SP_ID WHERE SP_METADATA.NAME=? and " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"SP_METADATA ON SP_APP.ID = SP_METADATA.SP_ID WHERE SP_METADATA.NAME=? and " + | |
"SP_METADATA ON SP_APP.ID = SP_METADATA.SP_ID WHERE SP_METADATA.NAME=? and " + |
a333a8b
to
9ae4f20
Compare
…g-application association
RoleManagementService roleManagementService = holder.getRoleManagementServiceV2(); | ||
try { | ||
if (roleManagementService != null) { | ||
List<RoleBasicInfo> listOfAllRoles = roleManagementService. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<RoleBasicInfo> listOfAllRoles = roleManagementService. | |
List<RoleBasicInfo> listOfAllOrgRoles = roleManagementService. |
try { | ||
if (roleManagementService != null) { | ||
List<RoleBasicInfo> listOfAllRoles = roleManagementService. | ||
getRoles(RoleConstants.AUDIENCE + SPACE + RoleConstants.EQ + SPACE + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any max limit defined in role mgt service when request to get all roles matching to a filter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this is fixed in the same PR. Hence ignore the comment
* | ||
* @param key Name of the sp metadata property key | ||
* @param value Value of the sp metadata property value | ||
* @return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return | |
* @return Filtered applications' basic information. |
Proposed changes in this pull request
Modify the core to support removing the necessity of having role_org-application association
When should this PR be merged
Immediately