/** * {@inheritDoc} */ @Override public ImmutableSet<String> getPrivileges(Set<String> groups, ActiveRoleSet roleSet, Authorizable... authorizableHierarchy) { if (!initialized) { throw new IllegalStateException("Backend has not been properly initialized"); } ImmutableSet.Builder<String> resultBuilder = ImmutableSet.builder(); for (String groupName : groups) { for (Map.Entry<String, Set<String>> row : groupRolePrivilegeTable.row(groupName) .entrySet()) { if (roleSet.containsRole(row.getKey())) { resultBuilder.addAll(row.getValue()); } } } return resultBuilder.build(); }
/** * {@inheritDoc} */ @Override public ImmutableSet<String> getRoles(Set<String> groups, ActiveRoleSet roleSet) { if (!initialized) { throw new IllegalStateException("Backend has not been properly initialized"); } ImmutableSet.Builder<String> resultBuilder = ImmutableSet.builder(); if (groups != null) { for (String groupName : groups) { for (Map.Entry<String, Set<String>> row : groupRolePrivilegeTable.row(groupName) .entrySet()) { if (roleSet.containsRole(row.getKey())) { resultBuilder.add(row.getKey()); } } } } return resultBuilder.build(); }
public ImmutableSet<String> getPrivileges(Set<String> groups, ActiveRoleSet roleSet, Authorizable... authorizableHierarchy) { if (!initialized) { throw new IllegalStateException("CacheProvider has not been properly initialized"); } ImmutableSet.Builder<String> resultBuilder = ImmutableSet.builder(); for (String groupName : groups) { for (Map.Entry<String, Set<String>> row : cache.getCache().row(groupName).entrySet()) { if (roleSet.containsRole(row.getKey())) { // TODO: SENTRY-1245: Filter by Authorizables, if provided resultBuilder.addAll(row.getValue()); } } } return resultBuilder.build(); }
public ImmutableSet<String> getRoles(Set<String> groups, ActiveRoleSet roleSet) { if (!initialized) { throw new IllegalStateException("CacheProvider has not been properly initialized"); } ImmutableSet.Builder<String> resultBuilder = ImmutableSet.builder(); if (groups != null) { for (String groupName : groups) { for (Map.Entry<String, Set<String>> row : cache.getCache().row(groupName) .entrySet()) { if (roleSet.containsRole(row.getKey())) { resultBuilder.add(row.getKey()); } } } } return resultBuilder.build(); } }