Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro93 committed Nov 7, 2023
1 parent 1feab32 commit 2f2d8f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ public AuthorizedActors authorizedActors(
// Step 3: For each matching policy, add actors that are authorized.
authorizedUsers.addAll(matchingActors.getUsers());
authorizedGroups.addAll(matchingActors.getGroups());
authorizedRoles.add(matchingActors.getRoles());
if (matchingActors.allUsers()) {
authorizedRoles.addAll(matchingActors.getRoles());
if (matchingActors.getAllUsers()) {
allUsers = true;
}
if (matchingActors.allGroups()) {
if (matchingActors.getAllGroups()) {
allGroups = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.linkedin.identity.RoleMembership;
import com.linkedin.metadata.Constants;
import com.linkedin.metadata.authorization.PoliciesConfig;
import com.linkedin.pegasus2avro.common.AccessLevel;
import com.linkedin.policy.DataHubActorFilter;
import com.linkedin.policy.DataHubPolicyInfo;
import com.linkedin.policy.DataHubResourceFilter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.datahub.authorization;

import com.datahub.authentication.Authentication;
import com.datastax.oss.driver.shaded.guava.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -1058,8 +1057,8 @@ public void testGetMatchingActorsResourceMatch() throws Exception {
Collections.emptySet(), Collections.emptySet());
PolicyEngine.PolicyActors actors = _policyEngine.getMatchingActors(dataHubPolicyInfo, Optional.of(resourceSpec));

assertTrue(actors.allUsers());
assertTrue(actors.allGroups());
assertTrue(actors.getAllUsers());
assertTrue(actors.getAllGroups());

assertEquals(actors.getUsers(),
ImmutableList.of(Urn.createFromString("urn:li:corpuser:user1"), Urn.createFromString("urn:li:corpuser:user2"),
Expand Down Expand Up @@ -1110,8 +1109,8 @@ public void testGetMatchingActorsNoResourceMatch() throws Exception {
buildEntityResolvers("dataset", "urn:li:dataset:random"); // A resource not covered by the policy.
PolicyEngine.PolicyActors actors = _policyEngine.getMatchingActors(dataHubPolicyInfo, Optional.of(resourceSpec));

assertFalse(actors.allUsers());
assertFalse(actors.allGroups());
assertFalse(actors.getAllUsers());
assertFalse(actors.getAllGroups());
assertEquals(actors.getUsers(), Collections.emptyList());
assertEquals(actors.getGroups(), Collections.emptyList());

Expand Down

0 comments on commit 2f2d8f9

Please sign in to comment.