Skip to content

Commit

Permalink
Merge pull request #7295 from ShanChathusanda93/app-role-assoc-apps-b…
Browse files Browse the repository at this point in the history
…ranch

Remove shared applications from the role creation wizard in sub org level
  • Loading branch information
ShanChathusanda93 authored Jan 11, 2025
2 parents 38201e6 + 6380a4e commit 7f7185c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 31 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-sheep-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.roles.v2": patch
---

Remove shared apps from the role creation wizard
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jest.mock("@wso2is/admin.applications.v1/api/application", () => ({
applications: [
{
"access": "WRITE",
"advancedConfigurations": {
"fragment": false
},
"associatedRoles": {
"allowedAudience": "ORGANIZATION"
},
Expand Down
65 changes: 34 additions & 31 deletions features/admin.roles.v2/components/wizard-updated/role-basics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export const RoleBasics: FunctionComponent<RoleBasicProps> = (props: RoleBasicPr
isLoading: isApplicationListFetchRequestLoading,
error: applicationListFetchRequestError,
mutate: mutateApplicationListFetchRequest
} = useApplicationList("clientId,associatedRoles.allowedAudience", null, null, applicationSearchQuery);
} = useApplicationList("clientId,associatedRoles.allowedAudience,advancedConfigurations", null, null,
applicationSearchQuery);

const {
data: rolesList,
Expand Down Expand Up @@ -146,36 +147,38 @@ export const RoleBasics: FunctionComponent<RoleBasicProps> = (props: RoleBasicPr

applicationList?.applications?.map((application: ApplicationListItemInterface) => {
if (!RoleConstants.READONLY_APPLICATIONS_CLIENT_IDS.includes(application?.clientId)) {
options.push({
content: (
<ListItemText
primary={ application.name }
secondary={
application?.associatedRoles?.allowedAudience === RoleAudienceTypes.ORGANIZATION
? (
<>
{ t("roles:addRoleWizard.forms.roleBasicDetails." +
"assignedApplication.applicationSubTitle.organization") }
<Link
data-componentid={ `${componentId}-link-navigate-roles` }
onClick={ () => navigateToApplicationEdit(application?.id) }
external={ false }
>
{ t("roles:addRoleWizard.forms." +
"roleBasicDetails.assignedApplication.applicationSubTitle." +
"changeAudience") }
</Link>
</>
) : t("roles:addRoleWizard.forms.roleBasicDetails." +
"assignedApplication.applicationSubTitle.application")
}
/>
),
disabled: application?.associatedRoles?.allowedAudience === RoleAudienceTypes.ORGANIZATION,
key: application.id,
text: application.name,
value: application.id
});
if (application?.advancedConfigurations?.fragment === false) {
options.push({
content: (
<ListItemText
primary={ application.name }
secondary={
application?.associatedRoles?.allowedAudience === RoleAudienceTypes.ORGANIZATION
? (
<>
{ t("roles:addRoleWizard.forms.roleBasicDetails." +
"assignedApplication.applicationSubTitle.organization") }
<Link
data-componentid={ `${componentId}-link-navigate-roles` }
onClick={ () => navigateToApplicationEdit(application?.id) }
external={ false }
>
{ t("roles:addRoleWizard.forms." +
"roleBasicDetails.assignedApplication.applicationSubTitle." +
"changeAudience") }
</Link>
</>
) : t("roles:addRoleWizard.forms.roleBasicDetails." +
"assignedApplication.applicationSubTitle.application")
}
/>
),
disabled: application?.associatedRoles?.allowedAudience === RoleAudienceTypes.ORGANIZATION,
key: application.id,
text: application.name,
value: application.id
});
}
}
});

Expand Down

0 comments on commit 7f7185c

Please sign in to comment.