Tabnine Logo
MSentryRole.getGroups
Code IndexAdd Tabnine to your IDE (free)

How to use
getGroups
method
in
org.apache.sentry.provider.db.service.model.MSentryRole

Best Java code snippets using org.apache.sentry.provider.db.service.model.MSentryRole.getGroups (Showing top 7 results out of 315)

origin: apache/sentry

private TSentryRole convertToTSentryRole(MSentryRole mSentryRole) {
 String roleName = mSentryRole.getRoleName().intern();
 Set<MSentryGroup> groups = mSentryRole.getGroups();
 Set<TSentryGroup> sentryGroups = new HashSet<>(groups.size());
 for(MSentryGroup mSentryGroup: groups) {
  TSentryGroup group = convertToTSentryGroup(mSentryGroup);
  sentryGroups.add(group);
 }
 return new TSentryRole(roleName, sentryGroups, EMPTY_GRANTOR_PRINCIPAL);
}
origin: apache/sentry

private Map<String, Set<String>> getGroupRolesMap(Collection<MSentryRole> mSentryRoles) {
 if (mSentryRoles.isEmpty()) {
  return Collections.emptyMap();
 }
 Map<String, Set<String>> groupRolesMap = new HashMap<>();
 // change the List<MSentryRole> -> Map<groupName, Set<roleName>>
 for (MSentryRole mSentryRole : mSentryRoles) {
  Set<MSentryGroup> groups = mSentryRole.getGroups();
  for (MSentryGroup group : groups) {
   String groupName = group.getGroupName();
   Set<String> rNames = groupRolesMap.get(groupName);
   if (rNames == null) {
    rNames = new HashSet<>();
   }
   rNames.add(mSentryRole.getRoleName());
   groupRolesMap.put(groupName, rNames);
  }
 }
 return groupRolesMap;
}
origin: apache/sentry

 public Set<TSentryRole> execute(PersistenceManager pm) throws Exception {
  Set<TSentryRole> tRoles = Sets.newHashSet();
  pm.setDetachAllOnCommit(false); // No need to detach objects
  Set<MSentryRole> mSentryRoles = Sets.newHashSet();
  if(groups.contains(null)) {
   mSentryRoles.addAll(delegate.getAllRoles(pm));
  } else {
   mSentryRoles = delegate.getRolesForGroups(pm, groups);
  }
  for(MSentryRole mSentryRole: mSentryRoles) {
   String roleName = mSentryRole.getRoleName().intern();
   Set<String> groupNames = Sets.newHashSet();
   Set<MSentryGroup> mSentryGroups = mSentryRole.getGroups();
   for(MSentryGroup mSentryGroup: mSentryGroups) {
    groupNames.add(mSentryGroup.getGroupName());
   }
   tRoles.add(new TSentryRole(roleName, groupNames));
  }
  return tRoles;
 }
});
origin: apache/incubator-sentry

private TSentryRole convertToTSentryRole(MSentryRole mSentryRole) {
 TSentryRole role = new TSentryRole();
 role.setRoleName(mSentryRole.getRoleName());
 role.setGrantorPrincipal("--");
 Set<TSentryGroup> sentryGroups = new HashSet<TSentryGroup>();
 for(MSentryGroup mSentryGroup:mSentryRole.getGroups()) {
  TSentryGroup group = convertToTSentryGroup(mSentryGroup);
  sentryGroups.add(group);
 }
 role.setGroups(sentryGroups);
 return role;
}
origin: apache/sentry

@Test
public void testAddDeleteGroups() throws Exception {
 String roleName = "test-groups";
 String grantor = "g1";
 createRole(roleName);
 Set<TSentryGroup> groups = Sets.newHashSet();
 TSentryGroup group = new TSentryGroup();
 group.setGroupName("test-groups-g1");
 groups.add(group);
 group = new TSentryGroup();
 group.setGroupName("test-groups-g2");
 groups.add(group);
 sentryStore.alterSentryRoleAddGroups(grantor, roleName, groups);
 sentryStore.alterSentryRoleDeleteGroups(roleName, groups);
 MSentryRole role = sentryStore.getMSentryRoleByName(roleName);
 assertEquals(Collections.emptySet(), role.getGroups());
}
origin: apache/incubator-sentry

@Test
public void testAddDeleteGroups() throws Exception {
 String roleName = "test-groups";
 String grantor = "g1";
 long seqId = sentryStore.createSentryRole(roleName).getSequenceId();
 Set<TSentryGroup> groups = Sets.newHashSet();
 TSentryGroup group = new TSentryGroup();
 group.setGroupName("test-groups-g1");
 groups.add(group);
 group = new TSentryGroup();
 group.setGroupName("test-groups-g2");
 groups.add(group);
 assertEquals(seqId + 1, sentryStore.alterSentryRoleAddGroups(grantor,
   roleName, groups).getSequenceId());
 assertEquals(seqId + 2, sentryStore.alterSentryRoleDeleteGroups(roleName, groups)
   .getSequenceId());
 MSentryRole role = sentryStore.getMSentryRoleByName(roleName);
 assertEquals(Collections.emptySet(), role.getGroups());
}
origin: apache/sentry

assertEquals(2, role.getGroups().size());
assertEquals(Collections.emptySet(), role.getGroups());
org.apache.sentry.provider.db.service.modelMSentryRolegetGroups

Popular methods of MSentryRole

  • <init>
  • getGmPrivileges
  • getPrivileges
  • removeGMPrivileges
  • removePrivileges
  • getRoleName
  • appendGMPrivilege
  • appendGroup
  • getUsers
  • removeGMPrivilege
  • removeGroup
  • appendPrivilege
  • removeGroup,
  • appendPrivilege,
  • appendUser,
  • removePrivilege,
  • removeUser

Popular in Java

  • Updating database using SQL prepared statement
  • runOnUiThread (Activity)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now