Skip to content

Commit

Permalink
Enable the role basics update and role permissions update for sub org…
Browse files Browse the repository at this point in the history
…anization roles
  • Loading branch information
ShanChathusanda93 committed Jan 26, 2025
1 parent 0f974ff commit 43f410a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-mice-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.roles.v2": patch
---

enable role basic update and role permission update in sub org roles
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { useAPIResources } from "@wso2is/admin.api-resources.v2/api";
import { useGetAuthorizedAPIList } from "@wso2is/admin.api-resources.v2/api/useGetAuthorizedAPIList";
import { APIResourceCategories, APIResourcesConstants } from "@wso2is/admin.api-resources.v2/constants";
import { APIResourceUtils } from "@wso2is/admin.api-resources.v2/utils/api-resource-utils";
import { useGetCurrentOrganizationType } from "@wso2is/admin.organizations.v1/hooks/use-get-organization-type";
import {
AlertInterface,
AlertLevels,
Expand Down Expand Up @@ -95,7 +94,6 @@ export const UpdatedRolePermissionDetails: FunctionComponent<RolePermissionDetai

const { t } = useTranslation();
const dispatch: Dispatch = useDispatch();
const { isSubOrganization } = useGetCurrentOrganizationType();

const [ isSubmitting, setIsSubmitting ] = useState<boolean>(false);
const [ selectedAPIResourceId, setSelectedAPIResourceId ] = useState<string>(undefined);
Expand All @@ -109,7 +107,7 @@ export const UpdatedRolePermissionDetails: FunctionComponent<RolePermissionDetai
const [ apiCallNextAfterValue, setAPICallNextAfterValue ] = useState<string>(null);

const shouldFetchAPIResources: boolean = role?.audience?.type?.
toUpperCase() === RoleAudienceTypes.ORGANIZATION && !isSubOrganization();
toUpperCase() === RoleAudienceTypes.ORGANIZATION;

const {
data: currentAPIResourcesListData,
Expand Down
6 changes: 2 additions & 4 deletions features/admin.roles.v2/components/edit-role/edit-role.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ export const EditRole: FunctionComponent<EditRoleProps> = (props: EditRoleProps)
const [ isAdminRole, setIsAdminRole ] = useState<boolean>(false);
const [ isEveryoneRole, setIsEveryoneRole ] = useState<boolean>(false);

const isSubOrg: boolean = organizationType === OrganizationType.SUBORGANIZATION;

/**
* Set the if the role is `Internal/admin`.
*/
Expand All @@ -122,7 +120,7 @@ export const EditRole: FunctionComponent<EditRoleProps> = (props: EditRoleProps)
render: () => (
<ResourceTab.Pane controlledSegmentation attached={ false }>
<BasicRoleDetails
isReadOnly={ isSubOrg || isAdminRole || isEveryoneRole || isReadOnly }
isReadOnly={ isAdminRole || isEveryoneRole || isReadOnly }
role={ roleObject }
onRoleUpdate={ onRoleUpdate }
tabIndex={ 0 }
Expand All @@ -135,7 +133,7 @@ export const EditRole: FunctionComponent<EditRoleProps> = (props: EditRoleProps)
render: () => (
<ResourceTab.Pane controlledSegmentation attached={ false }>
<UpdatedRolePermissionDetails
isReadOnly={ isSubOrg || isAdminRole || isReadOnly }
isReadOnly={ isAdminRole || isReadOnly }
role={ roleObject }
onRoleUpdate={ onRoleUpdate }
tabIndex={ 1 }
Expand Down

0 comments on commit 43f410a

Please sign in to comment.