HBASE-13246 Correct the assertion for namespace permissions in tearDown method of TestAccessController (Ashish Singhi)
This commit is contained in:
parent
663dacca9d
commit
9b4d78c33f
@ -285,7 +285,10 @@ public class TestAccessController extends SecureTestUtil {
|
|||||||
}
|
}
|
||||||
// Verify all table/namespace permissions are erased
|
// Verify all table/namespace permissions are erased
|
||||||
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
|
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
|
||||||
assertEquals(0, AccessControlLists.getNamespacePermissions(conf, TEST_TABLE.getTableName().getNameAsString()).size());
|
assertEquals(
|
||||||
|
0,
|
||||||
|
AccessControlLists.getNamespacePermissions(conf,
|
||||||
|
TEST_TABLE.getTableName().getNamespaceAsString()).size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -2084,7 +2087,7 @@ public class TestAccessController extends SecureTestUtil {
|
|||||||
AccessTestAction getAction = new AccessTestAction() {
|
AccessTestAction getAction = new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
Table t = TEST_UTIL.getConnection().getTable(TEST_TABLE.getTableName());
|
||||||
try {
|
try {
|
||||||
return t.get(new Get(TEST_ROW));
|
return t.get(new Get(TEST_ROW));
|
||||||
} finally {
|
} finally {
|
||||||
@ -2095,13 +2098,17 @@ public class TestAccessController extends SecureTestUtil {
|
|||||||
|
|
||||||
verifyDenied(getAction, USER_NONE);
|
verifyDenied(getAction, USER_NONE);
|
||||||
|
|
||||||
|
String namespace = "testNamespaceUserGrant";
|
||||||
|
NamespaceDescriptor desc = NamespaceDescriptor.create(namespace).build();
|
||||||
|
TEST_UTIL.getMiniHBaseCluster().getMaster().createNamespace(desc);
|
||||||
|
|
||||||
// Grant namespace READ to USER_NONE, this should supersede any table permissions
|
// Grant namespace READ to USER_NONE, this should supersede any table permissions
|
||||||
grantOnNamespace(TEST_UTIL, USER_NONE.getShortName(),
|
grantOnNamespace(TEST_UTIL, USER_NONE.getShortName(), namespace, Permission.Action.READ);
|
||||||
TEST_TABLE.getTableName().getNamespaceAsString(),
|
|
||||||
Permission.Action.READ);
|
|
||||||
|
|
||||||
// Now USER_NONE should be able to read also
|
// Now USER_NONE should be able to read also
|
||||||
verifyAllowed(getAction, USER_NONE);
|
verifyAllowed(getAction, USER_NONE);
|
||||||
|
|
||||||
|
TEST_UTIL.getMiniHBaseCluster().getMaster().deleteNamespace(namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -2299,7 +2306,7 @@ public class TestAccessController extends SecureTestUtil {
|
|||||||
AccessTestAction execEndpointAction = new AccessTestAction() {
|
AccessTestAction execEndpointAction = new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
Table t = TEST_UTIL.getConnection().getTable(TEST_TABLE.getTableName());
|
||||||
try {
|
try {
|
||||||
BlockingRpcChannel service = t.coprocessorService(HConstants.EMPTY_BYTE_ARRAY);
|
BlockingRpcChannel service = t.coprocessorService(HConstants.EMPTY_BYTE_ARRAY);
|
||||||
PingCoprocessor.newBlockingStub(service).noop(null, NoopRequest.newBuilder().build());
|
PingCoprocessor.newBlockingStub(service).noop(null, NoopRequest.newBuilder().build());
|
||||||
@ -2314,13 +2321,17 @@ public class TestAccessController extends SecureTestUtil {
|
|||||||
verifyDenied(execEndpointAction, userB);
|
verifyDenied(execEndpointAction, userB);
|
||||||
verifyAllowed(execEndpointAction, userA);
|
verifyAllowed(execEndpointAction, userA);
|
||||||
|
|
||||||
|
String namespace = "testCoprocessorExec";
|
||||||
|
NamespaceDescriptor desc = NamespaceDescriptor.create(namespace).build();
|
||||||
|
TEST_UTIL.getMiniHBaseCluster().getMaster().createNamespace(desc);
|
||||||
|
|
||||||
// Now grant EXEC to the entire namespace to user B
|
// Now grant EXEC to the entire namespace to user B
|
||||||
grantOnNamespace(TEST_UTIL, userB.getShortName(),
|
grantOnNamespace(TEST_UTIL, userB.getShortName(), namespace, Permission.Action.EXEC);
|
||||||
TEST_TABLE.getTableName().getNamespaceAsString(),
|
|
||||||
Permission.Action.EXEC);
|
|
||||||
|
|
||||||
// User B should now be allowed also
|
// User B should now be allowed also
|
||||||
verifyAllowed(execEndpointAction, userA, userB);
|
verifyAllowed(execEndpointAction, userA, userB);
|
||||||
|
|
||||||
|
TEST_UTIL.getMiniHBaseCluster().getMaster().deleteNamespace(namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user