Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Policy equality fails for binding list order #173

Closed
chingor13 opened this issue Mar 10, 2020 · 1 comment · Fixed by #174
Closed

Policy equality fails for binding list order #173

chingor13 opened this issue Mar 10, 2020 · 1 comment · Fixed by #174
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@chingor13
Copy link
Contributor

The binding list order should not matter for the equivalence of Policy objects:

  @Test
  public void testPolicyOrderShouldNotMatter() {
    Role role1 = Role.of("role1");
    Identity identity1 = Identity.user("user1@example.com");
    Role role2 = Role.of("role2");
    Identity identity2 = Identity.user("user2@example.com");
    Policy policy1 = Policy.newBuilder()
            .addIdentity(role1, identity1)
            .addIdentity(role2, identity2)
            .build();
    Policy policy2 = Policy.newBuilder()
            .addIdentity(role2, identity2)
            .addIdentity(role1, identity1)
            .build();
    assertEquals(policy1, policy2);
  }
@chingor13 chingor13 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 10, 2020
@chingor13
Copy link
Contributor Author

In #110, we switched the data model from a Map to a List and List equality is order dependenct

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants