Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[auth] Update Condition Attribute enum values #1147

Merged
merged 4 commits into from
Aug 2, 2019

Conversation

bcmdarroch
Copy link
Contributor

@bcmdarroch bcmdarroch commented Aug 1, 2019

🔩 Description: What code changed, and why?

The allowed values for a rule's Condition Attribute were a mix of plural and singular and didn't match how they're meant to be shown in the UI. Now they've been updated to match this list provided by superteam:

*Node Attributes*
Chef Organization
Chef Server
Environment
Chef Role
Chef Tag
Chef Policy Name
Chef Policy Group

*Event Attributes*
Chef Organization
Chef Server

👟 How to Build and Test the Change

curl -kH "api-token: $TOK" https://localhost/apis/iam/v2beta/projects -d "$(jq -n '{ id: "bar", name: "my bar project"}')" | jq .

# no longer works
curl -kH "api-token: $TOK" https://localhost/apis/iam/v2beta/projects/bar/rules -d "$(jq -n '{ id: "rule2", name: "my foo rule", type: "NODE", conditions: [{ operator: "EQUALS", attribute: "CHEF_ORGS", values: ["The Misfits"]}]}')" | jq .

# works
curl -kH "api-token: $TOK" https://localhost/apis/iam/v2beta/projects/bar/rules -d "$(jq -n '{ id: "rule2", name: "my foo rule", type: "NODE", conditions: [{ operator: "EQUALS", attribute: "CHEF_ORGANIZATION", values: ["The Misfits"]}]}')" | jq .

✅ Checklist

  • Tests added/updated?
  • Docs added/updated?

📷 Screenshots, if applicable

@bcmdarroch bcmdarroch added iamv2 This issue or pull request applies to iamv2 work for Automate auth-team anything that needs to be on the auth team board labels Aug 1, 2019
@bcmdarroch bcmdarroch requested a review from a team August 1, 2019 22:27
@bcmdarroch bcmdarroch requested a review from a team as a code owner August 1, 2019 22:27
@bcmdarroch bcmdarroch force-pushed the bd/update-condition-attribute-enums branch from 75f6d35 to 279236c Compare August 1, 2019 23:01
@blakestier
Copy link

:hrm: Are there any user-facing docs we'd need to update? Or concerns about backwards compatibility?

@susanev
Copy link
Contributor

susanev commented Aug 1, 2019

Copy link

@afiune afiune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ Love to see this kind of cleanup in the code! 💯

@@ -125,7 +125,7 @@ func nodeMatchesAllConditions(node backend.Node, conditions []*iam_v2.Condition)
if !foundMatch {
return false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nothing to do with this PR just a question to myself and @lancewf)

Do we need this foundMatch logic? why not just return true in like 121 like the other functions? (I might be missing something)

Copy link
Contributor

@msorens msorens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Brenna Hewer-Darroch added 4 commits August 2, 2019 11:25
Signed-off-by: Brenna Hewer-Darroch <brenna@chef.io>
Signed-off-by: Brenna Hewer-Darroch <brenna@chef.io>
Signed-off-by: Brenna Hewer-Darroch <brenna@chef.io>
Signed-off-by: Brenna Hewer-Darroch <brenna@chef.io>
@bcmdarroch bcmdarroch force-pushed the bd/update-condition-attribute-enums branch from 279236c to a564337 Compare August 2, 2019 18:26
@bcmdarroch bcmdarroch merged commit 1ffd163 into master Aug 2, 2019
@bcmdarroch bcmdarroch deleted the bd/update-condition-attribute-enums branch August 2, 2019 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth-team anything that needs to be on the auth team board iamv2 This issue or pull request applies to iamv2 work for Automate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants