Codota Logo
MSentryPrivilege.removeRole
Code IndexAdd Codota to your IDE (free)

How to use
removeRole
method
in
org.apache.sentry.provider.db.service.model.MSentryPrivilege

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: apache/incubator-sentry

public void removePrivilege(MSentryPrivilege privilege) {
 if (privileges.remove(privilege)) {
  privilege.removeRole(this);
 }
}
origin: apache/incubator-sentry

public void removePrivileges() {
 // copy is required since privilege.removeRole will call remotePrivilege
 for (MSentryPrivilege privilege : ImmutableSet.copyOf(privileges)) {
  privilege.removeRole(this);
 }
 Preconditions.checkState(privileges.isEmpty(), "Privileges should be empty: " + privileges);
}
origin: apache/incubator-sentry

/**
 * Revoke privilege from role
 */
private void revokePrivilegeFromRole(PersistenceManager pm, TSentryPrivilege tPrivilege,
  MSentryRole mRole, MSentryPrivilege mPrivilege) throws SentryInvalidInputException {
 if (PARTIAL_REVOKE_ACTIONS.contains(mPrivilege.getAction())) {
  // if this privilege is in {ALL,SELECT,INSERT}
  // we will do partial revoke
  revokePartial(pm, tPrivilege, mRole, mPrivilege);
 } else {
  // if this privilege is not ALL, SELECT nor INSERT,
  // we will revoke it from role directly
  MSentryPrivilege persistedPriv = getMSentryPrivilege(convertToTSentryPrivilege(mPrivilege), pm);
  if (persistedPriv != null) {
   mPrivilege.removeRole(mRole);
   privCleaner.incPrivRemoval();
   pm.makePersistent(mPrivilege);
  }
 }
}
origin: apache/incubator-sentry

/**
 * Roles can be granted ALL, SELECT, and INSERT on tables. When
 * a role has ALL and SELECT or INSERT are revoked, we need to remove the ALL
 * privilege and add SELECT (INSERT was revoked) or INSERT (SELECT was revoked).
 */
private void revokePartial(PersistenceManager pm,
  TSentryPrivilege requestedPrivToRevoke, MSentryRole mRole,
  MSentryPrivilege currentPrivilege) throws SentryInvalidInputException {
 MSentryPrivilege persistedPriv = getMSentryPrivilege(convertToTSentryPrivilege(currentPrivilege), pm);
 if (persistedPriv == null) {
  persistedPriv = convertToMSentryPrivilege(convertToTSentryPrivilege(currentPrivilege));
 }
 if (requestedPrivToRevoke.getAction().equalsIgnoreCase("ALL") || requestedPrivToRevoke.getAction().equalsIgnoreCase("*")) {
  persistedPriv.removeRole(mRole);
  privCleaner.incPrivRemoval();
  pm.makePersistent(persistedPriv);
 } else if (requestedPrivToRevoke.getAction().equalsIgnoreCase(AccessConstants.SELECT)
   && !currentPrivilege.getAction().equalsIgnoreCase(AccessConstants.INSERT)) {
  revokeRolePartial(pm, mRole, currentPrivilege, persistedPriv, AccessConstants.INSERT);
 } else if (requestedPrivToRevoke.getAction().equalsIgnoreCase(AccessConstants.INSERT)
   && !currentPrivilege.getAction().equalsIgnoreCase(AccessConstants.SELECT)) {
  revokeRolePartial(pm, mRole, currentPrivilege, persistedPriv, AccessConstants.SELECT);
 }
}
origin: apache/incubator-sentry

private void revokeRolePartial(PersistenceManager pm, MSentryRole mRole,
  MSentryPrivilege currentPrivilege, MSentryPrivilege persistedPriv, String addAction)
  throws SentryInvalidInputException {
 // If table / URI, remove ALL
 persistedPriv.removeRole(mRole);
 privCleaner.incPrivRemoval();
 pm.makePersistent(persistedPriv);
 currentPrivilege.setAction(AccessConstants.ALL);
 persistedPriv = getMSentryPrivilege(convertToTSentryPrivilege(currentPrivilege), pm);
 if (persistedPriv != null && mRole.getPrivileges().contains(persistedPriv)) {
  persistedPriv.removeRole(mRole);
  privCleaner.incPrivRemoval();
  pm.makePersistent(persistedPriv);
  currentPrivilege.setAction(addAction);
  persistedPriv = getMSentryPrivilege(convertToTSentryPrivilege(currentPrivilege), pm);
  if (persistedPriv == null) {
   persistedPriv = convertToMSentryPrivilege(convertToTSentryPrivilege(currentPrivilege));
   mRole.appendPrivilege(persistedPriv);
  }
  persistedPriv.appendRole(mRole);
  pm.makePersistent(persistedPriv);
 }
}
origin: apache/incubator-sentry

MSentryPrivilege mInsert = getMSentryPrivilege(tNotAll, pm);
if (mSelect != null && mRole.getPrivileges().contains(mSelect)) {
 mSelect.removeRole(mRole);
 privCleaner.incPrivRemoval();
 pm.makePersistent(mSelect);
 mInsert.removeRole(mRole);
 privCleaner.incPrivRemoval();
 pm.makePersistent(mInsert);
origin: apache/incubator-sentry

pm.retrieve(role);
hivePrivilege = (MSentryPrivilege)role.getPrivileges().toArray()[0];
hivePrivilege.removeRole(role);
pm.makePersistent(hivePrivilege);
commitTransaction(pm);
org.apache.sentry.provider.db.service.modelMSentryPrivilegeremoveRole

Popular methods of MSentryPrivilege

  • <init>
  • getAction
  • getColumnName
  • getDbName
  • getGrantOption
  • getServerName
  • getTableName
  • implies
    Return true if this privilege implies other privilege Otherwise, return false
  • setAction
  • setColumnName
  • setDbName
  • setGrantOption
  • setDbName,
  • setGrantOption,
  • setPrivilegeScope,
  • setServerName,
  • setTableName,
  • setURI,
  • appendPrincipal,
  • appendRole,
  • getCreateTime,
  • getPrivilegeScope

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now