This repository has been archived by the owner on Oct 20, 2022. It is now read-only.
[Fix/NiFiUser] Setting permissions on componentId level #104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this PR?
First draft to fix setting permissions on componentId level.
Additional context
Background info
When you try to get an accessPolicy by the name of the componentId from the nifi api you will get back the accessPolicy from its parent (and not null or empty) in case it has no accessPolicy yet.
(
entity, err := nClient.GetAccessPolicy(string(accessPolicy.Action), accessPolicy.GetResource(cluster))
in pkg/clientwrappers/accesspolicies/policies.go)Then nifikop thinks the accessPolicy already exists and does not create it.
That's why I added more or less an if statment (componentID_from_nifi_api != componentID_from_nifiuser). Then the accessPolicy does not exist yet and needs to be created.
Requirements
Example nifiuser CR
Here is an example to test a nifiuser including the edge case
resource: /
(adjust yourcomponentId
):Verify
In nifi UI under "User Policies" you can see now:
Without the fix no process group is mentioned under the "User Policies".
Checklist
Sorry for the bad code. I tried to make it understandable.
What do you think about that behavior?