Tabnine Logo
MSentryGMPrivilege.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.sentry.provider.db.service.model.MSentryGMPrivilege
constructor

Best Java code snippets using org.apache.sentry.provider.db.service.model.MSentryGMPrivilege.<init> (Showing top 20 results out of 315)

origin: apache/incubator-sentry

public Set<MSentryGMPrivilege> getPrivilegesByAuthorizable(String component,
  String service, Set<MSentryRole> roles,
  List<? extends Authorizable> authorizables, PersistenceManager pm) {
 Set<MSentryGMPrivilege> privilegeGraph = Sets.newHashSet();
 if (roles == null || roles.isEmpty()) {
  return privilegeGraph;
 }
 MSentryGMPrivilege parentPrivilege = new MSentryGMPrivilege(component, service, authorizables, null, null);
 privilegeGraph.addAll(populateIncludePrivileges(roles, parentPrivilege, pm));
 return privilegeGraph;
}
origin: apache/sentry

Set<MSentryGMPrivilege> getPrivilegesByAuthorizable(String component,
                          String service, Set<MSentryRole> roles,
                          List<? extends Authorizable> authorizables, PersistenceManager pm) {
 Set<MSentryGMPrivilege> privilegeGraph = Sets.newHashSet();
 if (roles == null || roles.isEmpty()) {
  return privilegeGraph;
 }
 MSentryGMPrivilege parentPrivilege = new MSentryGMPrivilege(component, service, authorizables, null, null);
 privilegeGraph.addAll(populateIncludePrivileges(roles, parentPrivilege, pm));
 return privilegeGraph;
}
origin: apache/incubator-sentry

 String grantorPrincipal, PersistenceManager pm)
 throws SentryUserException {
MSentryGMPrivilege oldPrivilege = new MSentryGMPrivilege(component, service, oldAuthorizables, null, null);
oldPrivilege.setAction(getAction(component,Action.ALL).getValue());
  authorizables.set(i, newAuthorizables.get(i));
 MSentryGMPrivilege newPrivilge = new MSentryGMPrivilege(
   component,service, authorizables, dropPrivilege.getAction(),
   dropPrivilege.getGrantOption());
origin: apache/sentry

 String grantorPrincipal, PersistenceManager pm)
 throws SentryUserException {
MSentryGMPrivilege oldPrivilege = new MSentryGMPrivilege(component, service, oldAuthorizables, null, null);
oldPrivilege.setAction(getAction(component,Action.ALL).getValue());
  authorizables.set(i, newAuthorizables.get(i));
 MSentryGMPrivilege newPrivilge = new MSentryGMPrivilege(
   component,service, authorizables, dropPrivilege.getAction(),
   dropPrivilege.getGrantOption());
origin: apache/sentry

private MSentryGMPrivilege convertToPrivilege(PrivilegeObject privilege) {
 return new MSentryGMPrivilege(privilege.getComponent(),
   privilege.getService(), privilege.getAuthorizables(),
   privilege.getAction(), privilege.getGrantOption());
}
origin: apache/incubator-sentry

private MSentryGMPrivilege convertToPrivilege(PrivilegeObject privilege) {
 return new MSentryGMPrivilege(privilege.getComponent(),
   privilege.getService(), privilege.getAuthorizables(),
   privilege.getAction(), privilege.getGrantOption());
}
origin: apache/incubator-sentry

public Set<PrivilegeObject> getPrivilegesByProvider(String component,
  String service, Set<MSentryRole> roles,
  List<? extends Authorizable> authorizables, PersistenceManager pm) {
 Set<PrivilegeObject> privileges = Sets.newHashSet();
 if (roles == null || roles.isEmpty()) {
  return privileges;
 }
 MSentryGMPrivilege parentPrivilege = new MSentryGMPrivilege(component, service, authorizables, null, null);
 Set<MSentryGMPrivilege> privilegeGraph = Sets.newHashSet();
 privilegeGraph.addAll(populateIncludePrivileges(roles, parentPrivilege, pm));
 for (MSentryGMPrivilege mPrivilege : privilegeGraph) {
  privileges.add(new Builder()
               .setComponent(mPrivilege.getComponentName())
               .setService(mPrivilege.getServiceName())
               .setAction(mPrivilege.getAction())
               .setAuthorizables(mPrivilege.getAuthorizables())
               .withGrantOption(mPrivilege.getGrantOption())
               .build());
 }
 return privileges;
}
origin: apache/sentry

Set<PrivilegeObject> getPrivilegesByProvider(String component,
                       String service, Set<MSentryRole> roles,
                       List<? extends Authorizable> authorizables, PersistenceManager pm) {
 Set<PrivilegeObject> privileges = Sets.newHashSet();
 if (roles == null || roles.isEmpty()) {
  return privileges;
 }
 MSentryGMPrivilege parentPrivilege = new MSentryGMPrivilege(component, service, authorizables, null, null);
 Set<MSentryGMPrivilege> privilegeGraph = Sets.newHashSet();
 privilegeGraph.addAll(populateIncludePrivileges(roles, parentPrivilege, pm));
 for (MSentryGMPrivilege mPrivilege : privilegeGraph) {
  privileges.add(new Builder()
               .setComponent(mPrivilege.getComponentName())
               .setService(mPrivilege.getServiceName())
               .setAction(mPrivilege.getAction())
               .setAuthorizables(mPrivilege.getAuthorizables())
               .withGrantOption(mPrivilege.getGrantOption())
               .build());
 }
 return privileges;
}
origin: apache/sentry

@Test
public void testValidateAuthorizables() throws Exception {
 try {
  new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection("c1"), new Field("f1")),SolrConstants.QUERY, false);
 } catch (IllegalStateException e) {
  fail("unexpect happend: it is a validated privilege");
 }
 try {
  new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection(""), new Field("f1")),SolrConstants.QUERY, false);
  fail("unexpect happend: it is not a validated privilege, The empty name of authorizable can't be empty");
 } catch (IllegalStateException e) {
 }
 try {
  new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(null, new Field("f1")),SolrConstants.QUERY, false);
  fail("unexpect happend: it is not a validated privilege, The authorizable can't be null");
 } catch (IllegalStateException e) {
 }
}
origin: apache/incubator-sentry

@Test
public void testValidateAuthorizables() throws Exception {
 try {
  new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection("c1"), new Field("f1")),SearchConstants.QUERY, false);
 } catch (IllegalStateException e) {
  fail("unexpect happend: it is a validated privilege");
 }
 try {
  new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection(""), new Field("f1")),SearchConstants.QUERY, false);
  fail("unexpect happend: it is not a validated privilege, The empty name of authorizable can't be empty");
 } catch (IllegalStateException e) {
 }
 try {
  new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(null, new Field("f1")),SearchConstants.QUERY, false);
  fail("unexpect happend: it is not a validated privilege, The authorizable can't be null");
 } catch (IllegalStateException e) {
 }
}
origin: apache/sentry

public void testSearchImpliesEqualAuthorizable() throws Exception {
 MSentryGMPrivilege serverPrivilege1 = new MSentryGMPrivilege("solr",
   "service1", null,SolrConstants.QUERY, false);
 MSentryGMPrivilege serverPrivilege2 = new MSentryGMPrivilege("solr",
   "service2", null,SolrConstants.QUERY, false);
 MSentryGMPrivilege collectionPrivilege1 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1")),
   SolrConstants.QUERY, false);
 MSentryGMPrivilege collectionPrivilege2 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c2")),
   SolrConstants.QUERY, false);
 MSentryGMPrivilege fieldPrivilege1 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
   SolrConstants.QUERY, false);
 MSentryGMPrivilege fieldPrivilege2 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1"), new Field("f2")),
   SolrConstants.QUERY, false);
origin: apache/incubator-sentry

public void testSearchImpliesEqualAuthorizable() throws Exception {
 MSentryGMPrivilege serverPrivilege1 = new MSentryGMPrivilege("solr",
   "service1", null,SearchConstants.QUERY, false);
 MSentryGMPrivilege serverPrivilege2 = new MSentryGMPrivilege("solr",
   "service2", null,SearchConstants.QUERY, false);
 MSentryGMPrivilege collectionPrivilege1 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1")),
   SearchConstants.QUERY, false);
 MSentryGMPrivilege collectionPrivilege2 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c2")),
   SearchConstants.QUERY, false);
 MSentryGMPrivilege fieldPrivilege1 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
   SearchConstants.QUERY, false);
 MSentryGMPrivilege fieldPrivilege2 = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1"), new Field("f2")),
   SearchConstants.QUERY, false);
origin: apache/incubator-sentry

MSentryGMPrivilege serverPrivilege = new MSentryGMPrivilege("solr",
  "service1", null, SearchConstants.QUERY, false);
MSentryGMPrivilege collectionPrivilege = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1")),
  SearchConstants.QUERY, false);
MSentryGMPrivilege fieldPrivilege = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
  SearchConstants.QUERY, false);
MSentryGMPrivilege fieldAllPrivilege = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1"), new Field(AccessConstants.ALL)),
  SearchConstants.QUERY, false);
MSentryGMPrivilege fieldPrivilege1 = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
  SearchConstants.QUERY, false);
MSentryGMPrivilege fieldPrivilege2 = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c2"), new Field("f2")),
  SearchConstants.QUERY, false);
origin: apache/sentry

MSentryGMPrivilege serverPrivilege = new MSentryGMPrivilege("solr",
  "service1", null, SolrConstants.QUERY, false);
MSentryGMPrivilege collectionPrivilege = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1")),
  SolrConstants.QUERY, false);
MSentryGMPrivilege fieldPrivilege = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
  SolrConstants.QUERY, false);
MSentryGMPrivilege fieldAllPrivilege = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1"), new Field(AccessConstants.ALL)),
  SolrConstants.QUERY, false);
MSentryGMPrivilege fieldPrivilege1 = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
  SolrConstants.QUERY, false);
MSentryGMPrivilege fieldPrivilege2 = new MSentryGMPrivilege("solr",
  "service1", Arrays.asList(new Collection("c2"), new Field("f2")),
  SolrConstants.QUERY, false);
origin: apache/sentry

@Test
public void testImpliesWithServerScope() throws Exception {
 //The persistent privilege is server scope
 MSentryGMPrivilege serverPrivilege = new MSentryGMPrivilege("solr",
   "service1", null,SolrConstants.QUERY, false);
 MSentryGMPrivilege collectionPrivilege = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1")),
   SolrConstants.QUERY, false);
 assertTrue(serverPrivilege.implies(collectionPrivilege));
 MSentryGMPrivilege fieldPrivilege = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
   SolrConstants.QUERY, false);
 assertTrue(serverPrivilege.implies(fieldPrivilege));
 assertTrue(collectionPrivilege.implies(fieldPrivilege));
 serverPrivilege.setAction(SolrConstants.UPDATE);
 assertFalse(serverPrivilege.implies(collectionPrivilege));
 assertFalse(serverPrivilege.implies(fieldPrivilege));
 serverPrivilege.setAction(SolrConstants.ALL);
 assertTrue(serverPrivilege.implies(collectionPrivilege));
 assertTrue(serverPrivilege.implies(fieldPrivilege));
}
/**
origin: apache/incubator-sentry

@Test
public void testImpliesWithServerScope() throws Exception {
 //The persistent privilege is server scope
 MSentryGMPrivilege serverPrivilege = new MSentryGMPrivilege("solr",
   "service1", null,SearchConstants.QUERY, false);
 MSentryGMPrivilege collectionPrivilege = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1")),
   SearchConstants.QUERY, false);
 assertTrue(serverPrivilege.implies(collectionPrivilege));
 MSentryGMPrivilege fieldPrivilege = new MSentryGMPrivilege("solr",
   "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
   SearchConstants.QUERY, false);
 assertTrue(serverPrivilege.implies(fieldPrivilege));
 assertTrue(collectionPrivilege.implies(fieldPrivilege));
 serverPrivilege.setAction(SearchConstants.UPDATE);
 assertFalse(serverPrivilege.implies(collectionPrivilege));
 assertFalse(serverPrivilege.implies(fieldPrivilege));
 serverPrivilege.setAction(SearchConstants.ALL);
 assertTrue(serverPrivilege.implies(collectionPrivilege));
 assertTrue(serverPrivilege.implies(fieldPrivilege));
}
/**
origin: apache/sentry

 @Test
 public void testSearchImpliesAction() throws Exception {
  /**
   * action is equal
   */
  MSentryGMPrivilege fieldPrivilege1 = new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection("c1"), new Field("f2")),
    SolrConstants.QUERY, false);

  MSentryGMPrivilege fieldPrivilege2 = new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection("c1"), new Field("f2")),
    SolrConstants.QUERY, false);

  assertTrue(fieldPrivilege1.implies(fieldPrivilege2));

  /**
   * action isn't equal
   */
  fieldPrivilege2.setAction(SolrConstants.UPDATE);
  assertFalse(fieldPrivilege1.implies(fieldPrivilege2));
  /**
   * action isn't equal,but the persistent privilege has the ALL action
   */
  fieldPrivilege1.setAction(SolrConstants.ALL);
  assertTrue(fieldPrivilege1.implies(fieldPrivilege2));
 }
}
origin: apache/incubator-sentry

 @Test
 public void testSearchImpliesAction() throws Exception {
  /**
   * action is equal
   */
  MSentryGMPrivilege fieldPrivilege1 = new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection("c1"), new Field("f2")),
    SearchConstants.QUERY, false);

  MSentryGMPrivilege fieldPrivilege2 = new MSentryGMPrivilege("solr",
    "service1", Arrays.asList(new Collection("c1"), new Field("f2")),
    SearchConstants.QUERY, false);

  assertTrue(fieldPrivilege1.implies(fieldPrivilege2));

  /**
   * action isn't equal
   */
  fieldPrivilege2.setAction(SearchConstants.UPDATE);
  assertFalse(fieldPrivilege1.implies(fieldPrivilege2));
  /**
   * action isn't equal,but the persistent privilege has the ALL action
   */
  fieldPrivilege1.setAction(SearchConstants.ALL);
  assertTrue(fieldPrivilege1.implies(fieldPrivilege2));
 }
}
origin: apache/incubator-sentry

hivePrivilege.setGrantOption(true);
MSentryGMPrivilege solrPrivilege = new MSentryGMPrivilege();
solrPrivilege.setComponentName("solr");
solrPrivilege.setServiceName("solr.server1");
origin: apache/sentry

hivePrivilege.setGrantOption(true);
MSentryGMPrivilege solrPrivilege = new MSentryGMPrivilege();
solrPrivilege.setComponentName("solr");
solrPrivilege.setServiceName("solr.server1");
org.apache.sentry.provider.db.service.modelMSentryGMPrivilege<init>

Popular methods of MSentryGMPrivilege

  • appendRole
  • implies
    Return true if this privilege implies request privilege Otherwise, return false
  • removeRole
  • setAction
  • setAuthorizables
    Only allow strict hierarchies. That is, can level =1 be not null when level = 0 is null
  • getAction
  • getAuthorizables
  • getComponentName
  • getField
  • getGrantOption
  • getRoles
  • getScope
  • getRoles,
  • getScope,
  • getServiceName,
  • isNULL,
  • notNULL,
  • setComponentName,
  • setField,
  • setGrantOption,
  • setRoles

Popular in Java

  • Start an intent from android
  • putExtra (Intent)
  • getResourceAsStream (ClassLoader)
  • getSharedPreferences (Context)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Join (org.hibernate.mapping)
  • 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