Skip to content

Commit

Permalink
RANGER-4983 : Ranger Audit Filter for the HBase service is not workin…
Browse files Browse the repository at this point in the history
…g as expected
  • Loading branch information
dhavaljrajpara committed Jan 24, 2025
1 parent 7a6c0f6 commit cb303cf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ class ServiceDefinition extends Component {
{resources[key].isExcludes !== undefined ? (
<h6 className="d-inline">
{resources[key].isExcludes ? (
<span className="badge bg-dark float-end">Include</span>
) : (
<span className="badge bg-dark float-end">Exclude</span>
) : (
<span className="badge bg-dark float-end">Include</span>
)}
</h6>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,53 +226,37 @@ class ServiceForm extends Component {
if (key === "resources" && !isEmpty(value)) {
obj.resources = {};

let levels = uniq(map(serviceDef.resources, "level"));

levels.map((level) => {
let resourceObj = find(serviceDef.resources, {
level: level,
name: value[`resourceName-${level}`]?.name
});
if (
value[`resourceName-${level}`] !== undefined &&
value[`value-${level}`] !== undefined
) {
obj.resources[value[`resourceName-${level}`].name] = {
values: isArray(value[`value-${level}`])
? map(value[`value-${level}`], "value")
: [value[`value-${level}`].value]
const levels = uniq(map(serviceDef.resources, "level"));

levels.forEach((level) => {
const resourceName = value[`resourceName-${level}`]?.name;
const resourceValue = value[`value-${level}`];
const isRecursiveSupport = value[`isRecursiveSupport-${level}`];
const isExcludesSupport = value[`isExcludesSupport-${level}`];

if (resourceName && resourceValue !== undefined) {
const resourceObj = find(serviceDef.resources, {
level,
name: resourceName
});

obj.resources[resourceName] = {
values: Array.isArray(resourceValue)
? map(resourceValue, "value")
: [resourceValue.value]
};

if (
value[`isRecursiveSupport-${level}`] !== undefined &&
resourceObj.recursiveSupported
) {
obj.resources[
value[`resourceName-${level}`].name
].isRecursive = value[`isRecursiveSupport-${level}`];
} else if (
value[`isRecursiveSupport-${level}`] === undefined &&
resourceObj.recursiveSupported
) {
obj.resources[
value[`resourceName-${level}`].name
].isRecursive = resourceObj.recursiveSupported;
if (resourceObj?.recursiveSupported) {
obj.resources[resourceName].isRecursive =
isRecursiveSupport !== undefined
? isRecursiveSupport
: resourceObj.recursiveSupported;
}

if (
value[`isExcludesSupport-${level}`] !== undefined &&
resourceObj.excludesSupported
) {
obj.resources[
value[`resourceName-${level}`].name
].isExcludes = value[`isExcludesSupport-${level}`];
} else if (
value[`isExcludesSupport-${level}`] === undefined &&
resourceObj.excludesSupported
) {
obj.resources[
value[`resourceName-${level}`].name
].isExcludes = resourceObj.excludesSupported;
if (resourceObj?.excludesSupported) {
obj.resources[resourceName].isExcludes =
isExcludesSupport !== undefined
? !isExcludesSupport
: false;
}
}
});
Expand Down Expand Up @@ -521,7 +505,7 @@ class ServiceForm extends Component {
);
if (setResources?.excludesSupported) {
obj.resources[`isExcludesSupport-${setResources.level}`] =
value?.isExcludes != false;
value?.isExcludes ? !value.isExcludes : true;
}
if (setResources?.recursiveSupported) {
obj.resources[`isRecursiveSupport-${setResources.level}`] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export const ServiceViewDetails = (props) => {
{resources[key].isExcludes !== undefined ? (
<h6 className="d-inline">
{resources[key].isExcludes ? (
<span className="badge bg-dark float-end">Include</span>
) : (
<span className="badge bg-dark float-end">Exclude</span>
) : (
<span className="badge bg-dark float-end">Include</span>
)}
</h6>
) : (
Expand Down

0 comments on commit cb303cf

Please sign in to comment.