From 2e4a8c17baec963c190966be11a934f72373644b Mon Sep 17 00:00:00 2001 From: Dhaval Rajpara Date: Wed, 29 Nov 2023 10:34:14 +0530 Subject: [PATCH] RANGER-4010 : [addendum] Update policy UI to support multiple resource-sets for react ranger. Signed-off-by: Dineshkumar Yadav --- .../react-webapp/src/components/Editable.jsx | 2 +- .../PolicyListing/PolicyPermissionItem.jsx | 48 ++++++++++++++----- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/security-admin/src/main/webapp/react-webapp/src/components/Editable.jsx b/security-admin/src/main/webapp/react-webapp/src/components/Editable.jsx index 98495f6cc8..128a235b4b 100644 --- a/security-admin/src/main/webapp/react-webapp/src/components/Editable.jsx +++ b/security-admin/src/main/webapp/react-webapp/src/components/Editable.jsx @@ -160,7 +160,7 @@ const CustomCondition = (props) => { return ( <> {conditionDefVal?.length > 0 && - conditionDefVal.map((m, index) => { + conditionDefVal.map((m) => { let uiHintAttb = m.uiHint != undefined && m.uiHint != "" ? JSON.parse(m.uiHint) : ""; if (uiHintAttb != "") { diff --git a/security-admin/src/main/webapp/react-webapp/src/views/PolicyListing/PolicyPermissionItem.jsx b/security-admin/src/main/webapp/react-webapp/src/views/PolicyListing/PolicyPermissionItem.jsx index ab9b3ce88b..f9fe4a38d6 100644 --- a/security-admin/src/main/webapp/react-webapp/src/views/PolicyListing/PolicyPermissionItem.jsx +++ b/security-admin/src/main/webapp/react-webapp/src/views/PolicyListing/PolicyPermissionItem.jsx @@ -151,6 +151,8 @@ export default function PolicyPermissionItem(props) { } } multiplePermissionItem = [...multiplePermissionItem, ...op]; + } else { + multiplePermissionItem = [...srcOp]; } break; } @@ -498,6 +500,7 @@ export default function PolicyPermissionItem(props) { ); } else { + let accessTypeOptions = getAccessTypeOptions(); return ( ( -
- -
- )} + render={({ input, meta }) => { + if ( + formValues[attrName][index]?.accesses && + isArray( + formValues[attrName][index].accesses + ) && + changePolicyItemPermissions + ) { + let accTypeVal = filter( + formValues[attrName][index].accesses, + (m) => { + if (some(accessTypeOptions, m)) { + return m; + } + } + ); + if (!isEqual(input.value, accTypeVal)) { + input.onChange(accTypeVal); + } + } + return ( +
+ +
+ ); + }} /> );