@Test public void testReadRolesInSchema() throws Exception { final MondrianCatalogHelper helper = (MondrianCatalogHelper) PentahoSystem.get(IMondrianCatalogService.class); Assert.assertNotNull(helper); MondrianCatalog mc = SecurityHelper.getInstance() .runAsUser( "admin", new Callable<MondrianCatalog>() { @Override public MondrianCatalog call() throws Exception { return helper.getCatalog("SteelWheelsRoles", PentahoSessionHolder.getSession()); } }); Assert.assertNotNull(mc); MondrianSchema ms = mc.getSchema(); Assert.assertNotNull(ms); String[] roleNames = ms.getRoleNames(); Assert.assertNotNull(roleNames); Assert.assertEquals(2, roleNames.length); Assert.assertEquals("Role1", roleNames[0]); Assert.assertEquals("Role2", roleNames[1]); }
/** * Return the list of mondrian cubes in the platform * * @return list of cubes */ @GET @Path("/cubes") @Produces({APPLICATION_JSON, APPLICATION_XML}) public List<Cube> getMondrianCatalogs() { ArrayList<Cube> cubes = new ArrayList<Cube>(); IMondrianCatalogService mondrianCatalogService = PentahoSystem.get( IMondrianCatalogService.class, "IMondrianCatalogService", getPentahoSession()); //$NON-NLS-1$ List<MondrianCatalog> catalogs = mondrianCatalogService.listCatalogs(getPentahoSession(), true); for (MondrianCatalog cat : catalogs) { for (MondrianCube cube : cat.getSchema().getCubes()) { cubes.add(new Cube(cat.getName(), cube.getName(), cube.getId())); } } return cubes; }