Skip to content

Commit e013c5d

Browse files
committed
META-4203 Get roles for users from Ranger authz
(cherry picked from commit 921e82fe57bc62054cfebabd1d90cb39eb8d1a24) (cherry picked from commit facb302)
1 parent 0a1d531 commit e013c5d

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

auth-plugin-atlas/src/main/java/org/apache/atlas/authorization/atlas/authorizer/RangerAtlasAuthorizer.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,12 @@ public AtlasAccessorResponse getAccessors(AtlasTypeAccessRequest request) {
527527
}
528528

529529
@Override
530-
public Set<String> getRolesForCurrentUser() {
530+
public Set<String> getRolesForCurrentUser(String userName, Set<String> groups) {
531531
Set<String> ret = new HashSet<>();
532532

533533
RangerBasePlugin plugin = atlasPlugin;
534-
String userName = getCurrentUserName();
535534

536-
ret = plugin.getRolesFromUserAndGroups(userName, getCurrentUserGroups());
535+
ret = plugin.getRolesFromUserAndGroups(userName, groups);
537536

538537
return ret;
539538
}

authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public static Set<String> getRolesForCurrentUser() throws AtlasBaseException {
262262
throw new AtlasAuthorizationException("Authorizer is null");
263263
}
264264

265-
ret = authorizer.getRolesForCurrentUser();
265+
ret = authorizer.getRolesForCurrentUser(getCurrentUserName(), getCurrentUserGroups());
266266
} catch (AtlasAuthorizationException e) {
267267
LOG.error("Unable to obtain AtlasAuthorizer", e);
268268
}

authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public interface AtlasAuthorizer {
6767

6868
AtlasAccessorResponse getAccessors(AtlasTypeAccessRequest request);
6969

70-
default Set<String> getRolesForCurrentUser() {
70+
default Set<String> getRolesForCurrentUser(String userName, Set<String> groups) {
7171
return null;
7272
}
7373

0 commit comments

Comments
 (0)