-
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
Get discoverable applciations from root and sub organizations #5934
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5934 +/- ##
============================================
- Coverage 21.07% 21.05% -0.02%
Complexity 5626 5626
============================================
Files 1561 1561
Lines 99201 99298 +97
Branches 15188 15201 +13
============================================
+ Hits 20904 20905 +1
- Misses 75276 75374 +98
+ Partials 3021 3019 -2 ☔ View full report in Codecov by Sentry. |
...plication.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationMgtUtil.java
Outdated
Show resolved
Hide resolved
...plication.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationMgtUtil.java
Outdated
Show resolved
Hide resolved
* | ||
* @param tenantDomain | ||
* @return true if the tenant is a sub org | ||
* @throws OrganizationManagementException |
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.
return appDAO.getDiscoverableApplicationBasicInfo(limit, offset, filter, sortOrder, sortBy, tenantDomain); | ||
try { | ||
ApplicationDAO appDAO = ApplicationMgtSystemConfig.getInstance().getApplicationDAO(); | ||
if (ApplicationMgtUtil.isSubOrg(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.
Wny requirement to wrap this OrganizationManagementUtil.isOrganization(tenantDomain) with using an another util function?
Since the OrganizationManagementException is also handled here, we can directly use OrganizationManagementUtil.isOrganization(tenantDomain)
* @return parent organization id | ||
* @throws OrganizationManagementServerException | ||
*/ | ||
public static String getParentOrgId(String 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.
Change the method name and comments as getPrimaryOrgId / getRootOrgId.
Parent org means the immediate org in up, but primary means the root org the tree.
default List<ApplicationBasicInfo> getDiscoverableAppsInfoFromRootAndSubOrg(int limit, int offset, String filter, | ||
String sortOrder, String sortBy, String | ||
tenantDomain, String primaryOrgID) |
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 this correctly formatted?
...plication.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/ApplicationDAO.java
Outdated
Show resolved
Hide resolved
* @param tenantDomain Tenant domain | ||
* @param primaryOrgId Primary organization ID | ||
* @return Count of discoverable applications. | ||
* @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
...g/wso2/carbon/identity/application/mgt/internal/impl/DiscoverableApplicationManagerImpl.java
Outdated
Show resolved
Hide resolved
...g/wso2/carbon/identity/application/mgt/internal/impl/DiscoverableApplicationManagerImpl.java
Outdated
Show resolved
Hide resolved
...g/wso2/carbon/identity/application/mgt/internal/impl/DiscoverableApplicationManagerImpl.java
Outdated
Show resolved
Hide resolved
...g/wso2/carbon/identity/application/mgt/internal/impl/DiscoverableApplicationManagerImpl.java
Outdated
Show resolved
Hide resolved
public static class ApplicationSPSharedTableColumns { | ||
|
||
public static final String SHARED_IDP_ID = "SHARED_IDP_ID"; | ||
public static final String OWNER_ORG_ID = "OWNER_ORG_ID"; | ||
|
||
private ApplicationSPSharedTableColumns() { | ||
|
||
} |
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.
since SP_SHARED_APP table related queries are not managed in framework, it is not recommended to redefine column names of SP_SHARED_APP here.
Hope you can't even use import the constants from other repo due to cyclic dependencies.
Can't we take an approach like this.
- Implement another manager of https://github.com/wso2/carbon-identity-framework/blob/master/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/DiscoverableApplicationManager.java (name suggestion: sharedAppDiscoverableManager) in organizationApplication
- From the places where it invokes DiscoverableApplicationManager methods, pick the correct implementation. Evaluate whether we can do this without any cyclic dependency
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.
Couldn't we define the constants in the organization-mgt-core repo and use that instead of moving the logic to the organization management repo?. Was this comment or any other concern lead to move the logic. @asha15
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.
I restructured the code in a way we don't need this constant anymore. However having SP_SHARED_APP related queries in framework repo will give maintainability issues. that's why we moved it to organization management repo.
…n.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationMgtUtil.java Co-authored-by: Anuradha Karunarathna <anuradha199528@gmail.com>
Co-authored-by: Anuradha Karunarathna <anuradha199528@gmail.com>
Co-authored-by: Anuradha Karunarathna <anuradha199528@gmail.com>
Co-authored-by: Anuradha Karunarathna <anuradha199528@gmail.com>
Co-authored-by: Anuradha Karunarathna <anuradha199528@gmail.com>
…n.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/impl/DiscoverableApplicationManagerImpl.java Co-authored-by: Anuradha Karunarathna <anuradha199528@gmail.com>
Co-authored-by: Anuradha Karunarathna <anuradha199528@gmail.com>
@@ -273,6 +273,19 @@ default List<ApplicationBasicInfo> getDiscoverableApplicationBasicInfo(int limit | |||
return null; | |||
} | |||
|
|||
/** | |||
* Get discoverable applications from root and sub org. | |||
* |
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.
params are missing in the java doc comment
getDBQueryForDiscoverableAppsByName(databaseVendorType))) { | ||
statement.setString(1, tenantDomain); | ||
statement.setString(2, filterResolvedForSQL); | ||
statement.setString(3, primaryOrgID); |
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.
statement.setString(3, primaryOrgID); | |
statement.setString(3, primaryOrgID); |
validateForUnImplementedSortingAttributes(sortOrder, sortBy); | ||
validateAttributesForPagination(offset, limit); | ||
|
||
// TODO: 11/5/19 : Enforce a max limit |
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.
11/5/19 is a date it seems and shall we update that
Closing the PR as the improvement has been moved to wso2-extensions/identity-organization-management#392 |
Proposed changes in this pull request
currently we're retrieving the discoverable application only from the reverent tenant. However when it comes to sub organization the application should be fetched against root org and sub organization.
Tested with H2 DB.
When should this PR be merged
[Please describe any preconditions that need to be addressed before we
can merge this pull request.]
Follow up actions
[List any possible follow-up actions here; for instance, testing data
migrations, software that we need to install on staging and production
environments.]
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation