Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
Expand All @@ -42,13 +43,15 @@ public class RangerUserStoreCache {

private final int waitTimeInSeconds;
private final boolean dedupStrings;
private final boolean includeUserGroupMappings;
private final ReentrantLock lock = new ReentrantLock();
private RangerUserStore rangerUserStore;

private RangerUserStoreCache() {
RangerAdminConfig config = RangerAdminConfig.getInstance();

this.waitTimeInSeconds = config.getInt("ranger.admin.userstore.download.cache.max.waittime.for.update", MAX_WAIT_TIME_FOR_UPDATE);
this.includeUserGroupMappings = config.getBoolean("ranger.admin.userstore.include.usergroups.mappings", false);
this.dedupStrings = config.getBoolean("ranger.admin.userstore.dedup.strings", Boolean.TRUE);
this.rangerUserStore = new RangerUserStore();
}
Expand Down Expand Up @@ -93,7 +96,7 @@ public RangerUserStore getLatestRangerUserStoreOrCached(XUserMgr xUserMgr) {
final long startTimeMs = System.currentTimeMillis();
final Set<UserInfo> rangerUsersInDB = xUserMgr.getUsers();
final Set<GroupInfo> rangerGroupsInDB = xUserMgr.getGroups();
final Map<String, Set<String>> userGroups = xUserMgr.getUserGroups();
final Map<String, Set<String>> userGroups = includeUserGroupMappings ? xUserMgr.getUserGroups() : new HashMap<>();
final long dbLoadTime = System.currentTimeMillis() - startTimeMs;

if (LOG.isDebugEnabled()) {
Expand Down
10 changes: 10 additions & 0 deletions security-admin/src/main/resources/conf.dist/ranger-admin-site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,16 @@
<name>ranger.downloadpolicy.session.log.enabled</name>
<value>false</value>
</property>
<!-- User-store download Properties starts-->
<property>
<name>ranger.admin.userstore.include.usergroups.mappings</name>
<value>false</value>
<description>
When set to true, the user-store download API includes the user-to-group mappings (userGroupMapping) in the response payload,
</description>
</property>
<!-- User-store download Properties ends-->

<!-- Service user for KMS -->
<property>
<name>ranger.kms.service.user.hdfs</name>
Expand Down