Skip to content

Commit

Permalink
META-4203 Get roles for users from Ranger authz
Browse files Browse the repository at this point in the history
(cherry picked from commit 921e82fe57bc62054cfebabd1d90cb39eb8d1a24)
(cherry picked from commit facb302)
  • Loading branch information
nikhilbonte21 committed May 10, 2023
1 parent 0a1d531 commit e013c5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,12 @@ public AtlasAccessorResponse getAccessors(AtlasTypeAccessRequest request) {
}

@Override
public Set<String> getRolesForCurrentUser() {
public Set<String> getRolesForCurrentUser(String userName, Set<String> groups) {
Set<String> ret = new HashSet<>();

RangerBasePlugin plugin = atlasPlugin;
String userName = getCurrentUserName();

ret = plugin.getRolesFromUserAndGroups(userName, getCurrentUserGroups());
ret = plugin.getRolesFromUserAndGroups(userName, groups);

return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public static Set<String> getRolesForCurrentUser() throws AtlasBaseException {
throw new AtlasAuthorizationException("Authorizer is null");
}

ret = authorizer.getRolesForCurrentUser();
ret = authorizer.getRolesForCurrentUser(getCurrentUserName(), getCurrentUserGroups());
} catch (AtlasAuthorizationException e) {
LOG.error("Unable to obtain AtlasAuthorizer", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public interface AtlasAuthorizer {

AtlasAccessorResponse getAccessors(AtlasTypeAccessRequest request);

default Set<String> getRolesForCurrentUser() {
default Set<String> getRolesForCurrentUser(String userName, Set<String> groups) {
return null;
}

Expand Down

0 comments on commit e013c5d

Please sign in to comment.