@Override public List<HiveObjectPrivilege> listPrincipalGlobalGrants( String principalName, PrincipalType principalType) { return rawStore.listPrincipalGlobalGrants(principalName, principalType); }
private List<HiveObjectPrivilege> list_global_privileges( final String principalName, final PrincipalType principalType) throws TException { incrementCounter("list_security_user_grant"); try { if (principalName == null) { return getMS().listGlobalGrantsAll(); } return getMS().listPrincipalGlobalGrants(principalName, principalType); } catch (MetaException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
@Test public void testCreateAdminNAddUser() throws MetaException, NoSuchObjectException { Configuration conf = MetastoreConf.newMetastoreConf(); MetastoreConf.setVar(conf, ConfVars.USERS_IN_ADMIN_ROLE, "adminuser"); MetaStoreTestUtils.setConfForStandloneMode(conf); RawStore rawStore = new HMSHandler("testcreateroot", conf).getMS(); Role adminRole = rawStore.getRole(HiveMetaStore.ADMIN); Assert.assertTrue(adminRole.getOwnerName().equals(HiveMetaStore.ADMIN)); Assert.assertEquals(rawStore.listPrincipalGlobalGrants(HiveMetaStore.ADMIN, PrincipalType.ROLE) .get(0).getGrantInfo().getPrivilege(),"All"); Assert.assertEquals(rawStore.listRoles("adminuser", PrincipalType.USER).get(0). getRoleName(),HiveMetaStore.ADMIN); } }
@Override public List<HiveObjectPrivilege> listPrincipalGlobalGrants( String principalName, PrincipalType principalType) { return rawStore.listPrincipalGlobalGrants(principalName, principalType); }
private List<HiveObjectPrivilege> list_global_privileges( final String principalName, final PrincipalType principalType) throws TException { incrementCounter("list_security_user_grant"); try { if (principalName == null) { return getMS().listGlobalGrantsAll(); } return getMS().listPrincipalGlobalGrants(principalName, principalType); } catch (MetaException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
public List<HiveObjectPrivilege> list_global_privileges( final String principalName, final PrincipalType principalType) throws MetaException, TException { incrementCounter("list_security_user_grant"); try { List<MGlobalPrivilege> mUsers = getMS().listPrincipalGlobalGrants( principalName, principalType); if (mUsers.size() > 0) { List<HiveObjectPrivilege> result = new ArrayList<HiveObjectPrivilege>(); for (int i = 0; i < mUsers.size(); i++) { MGlobalPrivilege sUsr = mUsers.get(i); HiveObjectRef objectRef = new HiveObjectRef( HiveObjectType.GLOBAL, null, null, null, null); HiveObjectPrivilege secUser = new HiveObjectPrivilege( objectRef, sUsr.getPrincipalName(), principalType, new PrivilegeGrantInfo(sUsr.getPrivilege(), sUsr .getCreateTime(), sUsr.getGrantor(), PrincipalType .valueOf(sUsr.getGrantorType()), sUsr.getGrantOption())); result.add(secUser); } return result; } return Collections.<HiveObjectPrivilege> emptyList(); } catch (MetaException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
@Override List<HiveObjectPrivilege> run(RawStore ms) throws Exception { List<MGlobalPrivilege> mUsers = ms.listPrincipalGlobalGrants( principalName, principalType); if (mUsers.size() > 0) { List<HiveObjectPrivilege> result = new ArrayList<HiveObjectPrivilege>(); for (int i = 0; i < mUsers.size(); i++) { MGlobalPrivilege sUsr = mUsers.get(i); HiveObjectRef objectRef = new HiveObjectRef( HiveObjectType.GLOBAL, null, null, null, null); HiveObjectPrivilege secUser = new HiveObjectPrivilege( objectRef, sUsr.getPrincipalName(), principalType, new PrivilegeGrantInfo(sUsr.getPrivilege(), sUsr .getCreateTime(), sUsr.getGrantor(), PrincipalType .valueOf(sUsr.getGrantorType()), sUsr.getGrantOption())); result.add(secUser); } return result; } return null; } });
return getMS().listGlobalGrantsAll(); List<MGlobalPrivilege> mUsers = getMS().listPrincipalGlobalGrants( principalName, principalType); if (mUsers.isEmpty()) {
return getMS().listGlobalGrantsAll(); List<MGlobalPrivilege> mUsers = getMS().listPrincipalGlobalGrants( principalName, principalType); if (mUsers.isEmpty()) {