mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-16 12:38:13 +00:00
Fixing privilege option display bug (#4443)
This commit is contained in:
parent
bf35d4c83e
commit
58dab764c4
@ -179,22 +179,27 @@ export const PoliciesPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getPrivilegeNames = (policy: Omit<Policy, 'urn'>) => {
|
const getPrivilegeNames = (policy: Omit<Policy, 'urn'>) => {
|
||||||
let privilegeOptions: PrivilegeOptionType[] = [];
|
let privileges: PrivilegeOptionType[] = [];
|
||||||
if (policy?.type === PolicyType.Platform) {
|
if (policy?.type === PolicyType.Platform) {
|
||||||
privilegeOptions = platformPrivileges.map((platformPrivilege) => {
|
privileges = platformPrivileges
|
||||||
|
.filter((platformPrivilege) => policy.privileges.includes(platformPrivilege.type))
|
||||||
|
.map((platformPrivilege) => {
|
||||||
return { type: platformPrivilege.type, name: platformPrivilege.displayName };
|
return { type: platformPrivilege.type, name: platformPrivilege.displayName };
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const privilegeData = resourcePrivileges.filter(
|
const privilegeData = resourcePrivileges.filter(
|
||||||
(resourcePrivilege) => resourcePrivilege.resourceType === policy?.resources?.type,
|
(resourcePrivilege) => resourcePrivilege.resourceType === policy?.resources?.type,
|
||||||
);
|
);
|
||||||
privilegeOptions =
|
privileges =
|
||||||
privilegeData &&
|
(privilegeData.length > 0 &&
|
||||||
privilegeData[0]?.privileges.map((b) => {
|
privilegeData[0]?.privileges
|
||||||
|
.filter((resourcePrivilege) => policy.privileges.includes(resourcePrivilege.type))
|
||||||
|
.map((b) => {
|
||||||
return { type: b.type, name: b.displayName };
|
return { type: b.type, name: b.displayName };
|
||||||
});
|
})) ||
|
||||||
|
[];
|
||||||
}
|
}
|
||||||
return privilegeOptions;
|
return privileges;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onViewPolicy = (policy: Policy) => {
|
const onViewPolicy = (policy: Policy) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user