use of org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException in project accumulo by apache.
the class SecurityOperation method getUserAuthorizations.
public Authorizations getUserAuthorizations(TCredentials credentials, String user) throws ThriftSecurityException {
authenticate(credentials);
targetUserExists(user);
if (!credentials.getPrincipal().equals(user) && !hasSystemPermission(credentials, SystemPermission.SYSTEM, false) && !hasSystemPermission(credentials, SystemPermission.ALTER_USER, false))
throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
try {
return authorizor.getCachedUserAuthorizations(user);
} catch (AccumuloSecurityException e) {
throw e.asThriftException();
}
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException in project accumulo by apache.
the class SecurityOperation method revokeNamespacePermission.
public void revokeNamespacePermission(TCredentials c, String user, Namespace.ID namespace, NamespacePermission permission) throws ThriftSecurityException {
if (!canRevokeNamespace(c, user, namespace))
throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
targetUserExists(user);
try {
permHandle.revokeNamespacePermission(user, namespace, permission);
log.info("Revoked namespace permission {} for user {} on the namespace {} at the request of user {}", permission, user, namespace, c.getPrincipal());
} catch (AccumuloSecurityException e) {
throw e.asThriftException();
} catch (NamespaceNotFoundException e) {
throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.NAMESPACE_DOESNT_EXIST);
}
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException in project accumulo by apache.
the class SecurityOperation method revokeSystemPermission.
public void revokeSystemPermission(TCredentials credentials, String user, SystemPermission permission) throws ThriftSecurityException {
if (!canRevokeSystem(credentials, user, permission))
throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
targetUserExists(user);
try {
permHandle.revokeSystemPermission(user, permission);
log.info("Revoked system permission {} for user {} at the request of user {}", permission, user, credentials.getPrincipal());
} catch (AccumuloSecurityException e) {
throw e.asThriftException();
}
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException in project accumulo by apache.
the class SecurityOperation method changeAuthorizations.
public void changeAuthorizations(TCredentials credentials, String user, Authorizations authorizations) throws ThriftSecurityException {
if (!canChangeAuthorizations(credentials, user))
throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
targetUserExists(user);
try {
authorizor.changeAuthorizations(user, authorizations);
log.info("Changed authorizations for user {} at the request of user {}", user, credentials.getPrincipal());
} catch (AccumuloSecurityException ase) {
throw ase.asThriftException();
}
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException in project accumulo by apache.
the class SecurityOperation method dropUser.
public void dropUser(TCredentials credentials, String user) throws ThriftSecurityException {
if (!canDropUser(credentials, user))
throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
try {
authorizor.dropUser(user);
authenticator.dropUser(user);
permHandle.cleanUser(user);
log.info("Deleted user {} at the request of user {}", user, credentials.getPrincipal());
} catch (AccumuloSecurityException e) {
throw e.asThriftException();
}
}
Aggregations