Class UserConsoleResource
UserConsoleResource service provides both shared and user-specific state or settings related with the
use of the Pentaho User Console.
The following operations provide access to User Console system settings (shared by all users):
The UserConsoleResource exposes operations to access and manage user session variables. User
session variables are unique per user session and reset to their default values at every user session creation.
Contrast session variables with user settings, accessed via UserSettingsResource, which are
persisted across user sessions and shared by all active sessions of a user.
One last characteristic of session variables is that only those declared in the properties
userConsoleResource.getSessionVarWhiteList and userConsoleResource.setSessionVarWhiteList of the system
file system/restConfig.properties, can be read or modified via this class. By default, these are
scheduler_folder an showOverrideDialog.
Generic user session variables are accessed and managed via the operations:
The following operations expose specific (non-generic) user session information:
isAuthenticated()isAdministrator()getLocale()- gets the effective locale of the user sessionsetLocaleOverride(String)- sets the locale of the user session, viaLocaleHelper.setSessionLocaleOverride(Locale)andLocaleHelper.setThreadLocaleOverride(Locale)
The state changing operations of this service, with the notable exception of
setLocaleOverride(String), are protected against CSRF attacks, and thus require a CSRF
token to be called. This resolves to:
-
Field Summary
Fields inherited from class org.pentaho.platform.web.http.api.resources.AbstractJaxRSResource
acceptableMediaTypes, httpServletRequest, httpServletResponse, TEXT_HTML -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.ws.rs.core.ResponsebuildOkResponse(Object entity) jakarta.ws.rs.core.ResponseRemoves a session variable from the current user session.Returns the list of admin related settingsjakarta.ws.rs.core.ResponseReturn the server side localeReturn the current user console settingsReturn the list of mondrian cubes in the platformjakarta.ws.rs.core.ResponsegetSessionVariable(String key) Retrieves a session variable from the current user session.jakarta.ws.rs.core.ResponseReturns whether the current user is an administrator.jakarta.ws.rs.core.ResponseReturns whether the user is sn authenticated user or not.jakarta.ws.rs.core.Responsejakarta.ws.rs.core.ResponsesetLocaleOverride(String locale) Apply the selected locale to the user console.jakarta.ws.rs.core.ResponsesetSessionVariable(String key, String value) Sets a session variable for the current user session.Methods inherited from class org.pentaho.platform.web.http.api.resources.AbstractJaxRSResource
setHttpHeaders
-
Constructor Details
-
UserConsoleResource
-
-
Method Details
-
isAdministrator
@GET @Path("/isAdministrator") public jakarta.ws.rs.core.Response isAdministrator()Returns whether the current user is an administrator.Example Request:
GET pentaho/api/mantle/isAdministrator- Returns:
- String true if the user is an administrator, or false otherwise.
Example Response:
true
-
isAuthenticated
@GET @Path("/isAuthenticated") public jakarta.ws.rs.core.Response isAuthenticated()Returns whether the user is sn authenticated user or not.Example Request:
GET pentaho/api/mantle/isAuthenticated- Returns:
- String true if the user is an administrator, or false otherwise.
Example Response:
true
-
getAdminContent
@GET @Path("/getAdminContent") @Produces({"application/json","application/xml"}) public SettingsWrapper getAdminContent()Returns the list of admin related settings- Returns:
- list of settings
-
getMantleSettings
@GET @Path("/settings") @Produces({"application/json","application/xml"}) public SettingsWrapper getMantleSettings()Return the current user console settings- Returns:
- current settings
-
getMondrianCatalogs
@GET @Path("/cubes") @Produces({"application/json","application/xml"}) public CubesWrapper getMondrianCatalogs()Return the list of mondrian cubes in the platform- Returns:
- list of cubes
-
setLocaleOverride
Apply the selected locale to the user console.- Parameters:
locale- (user console's locale)- Returns:
-
getLocale
@GET @Path("/locale") public jakarta.ws.rs.core.Response getLocale()Return the server side locale- Returns:
- server's locale
-
setSessionVariable
@POST @Path("/session-variable") @Produces("text/plain") public jakarta.ws.rs.core.Response setSessionVariable(@QueryParam("key") String key, @QueryParam("value") String value) Sets a session variable for the current user session. If value is null, the session variable is removed.- Parameters:
key- The session variable name. Must be whitelisted.value- The value to set, or null to remove the variable.- Returns:
- A Response containing the set value, or null if removed
-
getSessionVariable
@GET @Path("/session-variable") @Produces({"text/plain","application/json","application/xml"}) public jakarta.ws.rs.core.Response getSessionVariable(@QueryParam("key") String key) Retrieves a session variable from the current user session.- Parameters:
key- The session variable name. Must be whitelisted.- Returns:
- A Response containing the session variable value, or no content if not found
-
clearSessionVariable
@DELETE @Path("/session-variable") public jakarta.ws.rs.core.Response clearSessionVariable(@QueryParam("key") String key) Removes a session variable from the current user session.- Parameters:
key- The session variable name. Must be whitelisted.- Returns:
- A Response containing the previous value, or null if not found
-
registeredPlugins
@GET @Path("/registeredPlugins") public jakarta.ws.rs.core.Response registeredPlugins() -
buildOkResponse
-