use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class UserRoleDaoResource method removeAllUsersFromRole.
/**
* Removes all users from a particular role
*
* @param tenantPath (tenant path where the user exist, null of empty string assumes default tenant)
* @param roleName (role name)
* @return
*/
@PUT
@Path("/removeAllUsersFromRole")
@Consumes({ MediaType.WILDCARD })
@Facet(name = "Unsupported")
public Response removeAllUsersFromRole(@QueryParam("tenant") String tenantPath, @QueryParam("roleName") String roleName) {
if (canAdminister()) {
try {
IUserRoleDao roleDao = getUserRoleDao();
roleDao.setRoleMembers(getTenant(tenantPath), roleName, new String[0]);
updateRolesForCurrentSession();
return Response.ok().build();
} catch (Throwable th) {
return processErrorResponse(th.getLocalizedMessage());
}
} else {
return Response.status(Response.Status.UNAUTHORIZED).build();
}
}
use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class PluginManagerResource method getOverlays.
/**
* Retrieve the list of XUL overlays for the provided id
*
* @param id
* @return list of <code> Overlay </code>
*/
@GET
@Path("/overlays")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public List<Overlay> getOverlays(@QueryParam("id") @DefaultValue("") String id) {
// $NON-NLS-1$
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, PentahoSessionHolder.getSession());
List<XulOverlay> overlays = pluginManager.getOverlays();
ArrayList<Overlay> result = new ArrayList<Overlay>();
for (XulOverlay overlay : overlays) {
if (!id.isEmpty() && !overlay.getId().equals(id)) {
continue;
}
Overlay tempOverlay = new Overlay(overlay.getId(), overlay.getOverlayUri(), overlay.getSource(), overlay.getResourceBundleUri(), overlay.getPriority());
result.add(tempOverlay);
}
return result;
}
use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class PluginManagerResource method getPluginPerpectives.
/**
* Retrieve the list of plugin perspective in the platform
*
* @return list of <code> PluginPerspective </code>
*/
@GET
@Path("/perspectives")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public ArrayList<PluginPerspective> getPluginPerpectives() {
IPluginPerspectiveManager manager = // $NON-NLS-1$
PentahoSystem.get(IPluginPerspectiveManager.class, PentahoSessionHolder.getSession());
ArrayList<PluginPerspective> perspectives = new ArrayList<PluginPerspective>();
for (IPluginPerspective perspective : manager.getPluginPerspectives()) {
PluginPerspective pp = new PluginPerspective();
pp.setId(perspective.getId());
pp.setTitle(perspective.getTitle());
pp.setContentUrl(perspective.getContentUrl());
pp.setLayoutPriority(perspective.getLayoutPriority());
pp.setRequiredSecurityActions(perspective.getRequiredSecurityActions());
pp.setResourceBundleUri(perspective.getResourceBundleUri());
if (perspective.getOverlays() != null) {
ArrayList<Overlay> safeOverlays = new ArrayList<Overlay>();
for (XulOverlay orig : perspective.getOverlays()) {
Overlay tempOverlay = new Overlay(orig.getId(), orig.getOverlayUri(), orig.getSource(), orig.getResourceBundleUri(), orig.getPriority());
safeOverlays.add(tempOverlay);
}
pp.setOverlays(safeOverlays);
}
perspectives.add(pp);
}
return perspectives;
}
use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class PluginManagerResource method getPluginSettings.
/**
* Retrieve the list of setting of a selected setting name from all registered plugins.
*
* @param settingName (name of the plugin setting)
* @return list of <code> Setting </code>
*/
@GET
@Path("/settings/{settingName}")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response getPluginSettings(@PathParam("settingName") String settingName) {
// A non-admin still require this setting. All other settings should be admin only
if (!NEW_TOOLBAR_BUTTON_SETTING.equals(settingName)) {
if (!canAdminister()) {
return Response.status(UNAUTHORIZED).build();
}
}
// $NON-NLS-1$
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, PentahoSessionHolder.getSession());
ArrayList<Setting> settings = new ArrayList<Setting>();
for (String id : pluginManager.getRegisteredPlugins()) {
Setting s = new Setting(id, (String) pluginManager.getPluginSetting(id, settingName, null));
if (!StringUtils.isEmpty(s.getValue())) {
settings.add(s);
}
}
return Response.ok(new JaxbList<Setting>(settings), MediaType.APPLICATION_JSON).build();
}
use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class AnalysisDatasourceService method putMondrianSchema.
/**
* This is used by PUC to use a Jersey put to import a Mondrian Schema XML into PUR
*
* @param dataInputStream
* @param schemaFileInfo
* @param catalogName
* @param datasourceName
* @param overwrite
* @param xmlaEnabledFlag
* @param parameters
* @param acl acl information for the data source. This parameter is optional.
* @return this method returns a response of "3" for success, 8 if exists, etc.
* @throws PentahoAccessControlException
*/
@PUT
@Path("/putSchema")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces("text/plain")
@Facet(name = "Unsupported")
public Response putMondrianSchema(@FormDataParam(UPLOAD_ANALYSIS) InputStream dataInputStream, @FormDataParam(UPLOAD_ANALYSIS) FormDataContentDisposition schemaFileInfo, // Optional
@FormDataParam(CATALOG_NAME) String catalogName, // Optional
@FormDataParam(ORIG_CATALOG_NAME) String origCatalogName, // Optional
@FormDataParam(DATASOURCE_NAME) String datasourceName, @FormDataParam(OVERWRITE_IN_REPOS) String overwrite, @FormDataParam(XMLA_ENABLED_FLAG) String xmlaEnabledFlag, @FormDataParam(PARAMETERS) String parameters, @FormDataParam(DATASOURCE_ACL) RepositoryFileAclDto acl) throws PentahoAccessControlException {
Response response = null;
int statusCode = PlatformImportException.PUBLISH_GENERAL_ERROR;
try {
AnalysisService service = new AnalysisService();
boolean overWriteInRepository = "True".equalsIgnoreCase(overwrite) ? true : false;
boolean xmlaEnabled = "True".equalsIgnoreCase(xmlaEnabledFlag) ? true : false;
service.putMondrianSchema(dataInputStream, schemaFileInfo, catalogName, origCatalogName, datasourceName, overWriteInRepository, xmlaEnabled, parameters, acl);
statusCode = SUCCESS;
} catch (PentahoAccessControlException pac) {
logger.error(pac.getMessage());
statusCode = PlatformImportException.PUBLISH_USERNAME_PASSWORD_FAIL;
} catch (PlatformImportException pe) {
statusCode = pe.getErrorStatus();
logger.error("Error putMondrianSchema " + pe.getMessage() + " status = " + statusCode);
} catch (Exception e) {
logger.error("Error putMondrianSchema " + e.getMessage());
statusCode = PlatformImportException.PUBLISH_GENERAL_ERROR;
}
response = Response.ok().status(statusCode).type(MediaType.TEXT_PLAIN).build();
logger.debug("putMondrianSchema Response " + response);
return response;
}
Aggregations