Class UserConsoleResource
- java.lang.Object
-
- org.pentaho.platform.web.http.api.resources.AbstractJaxRSResource
-
- org.pentaho.platform.web.http.api.resources.UserConsoleResource
-
public class UserConsoleResource extends AbstractJaxRSResource
TheUserConsoleResource
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 viaUserSettingsResource
, 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
anduserConsoleResource.setSessionVarWhiteList
of the system filesystem/restConfig.properties
, can be read or modified via this class. By default, these arescheduler_folder
andshowOverrideDialog
.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 session-
setLocaleOverride(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 Modifier and Type Field Description protected static UserConsoleService
userConsoleService
-
Fields inherited from class org.pentaho.platform.web.http.api.resources.AbstractJaxRSResource
acceptableMediaTypes, httpServletRequest, httpServletResponse, TEXT_HTML
-
-
Constructor Summary
Constructors Constructor Description UserConsoleResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.ws.rs.core.Response
buildOkResponse(Object entity)
javax.ws.rs.core.Response
clearSessionVariable(String key)
Deletes the value of a session variable.List<Setting>
getAdminContent()
Returns the list of admin related settingsjavax.ws.rs.core.Response
getLocale()
Return the server side localeList<Setting>
getMantleSettings()
Return the current user console settingsList<Cube>
getMondrianCatalogs()
Return the list of mondrian cubes in the platformjavax.ws.rs.core.Response
getSessionVariable(String key)
Gets the value of a session variable.javax.ws.rs.core.Response
isAdministrator()
Returns whether the current user is an administrator.javax.ws.rs.core.Response
isAuthenticated()
Returns whether the user is sn authenticated user or not.javax.ws.rs.core.Response
registeredPlugins()
javax.ws.rs.core.Response
setLocaleOverride(String locale)
Apply the selected locale to the user console.javax.ws.rs.core.Response
setSessionVariable(String key, String value)
Sets the value of a session variable.-
Methods inherited from class org.pentaho.platform.web.http.api.resources.AbstractJaxRSResource
setHttpHeaders
-
-
-
-
Field Detail
-
userConsoleService
protected static UserConsoleService userConsoleService
-
-
Method Detail
-
isAdministrator
public javax.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
public javax.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
public List<Setting> getAdminContent()
Returns the list of admin related settings- Returns:
- list of settings
-
getMantleSettings
public List<Setting> getMantleSettings()
Return the current user console settings- Returns:
- current settings
-
getMondrianCatalogs
public List<Cube> getMondrianCatalogs()
Return the list of mondrian cubes in the platform- Returns:
- list of cubes
-
setLocaleOverride
public javax.ws.rs.core.Response setLocaleOverride(String locale)
Apply the selected locale to the user console.- Parameters:
locale
- (user console's locale)- Returns:
-
getLocale
public javax.ws.rs.core.Response getLocale()
Return the server side locale- Returns:
- server's locale
-
setSessionVariable
public javax.ws.rs.core.Response setSessionVariable(String key, String value)
Sets the value of a session variable.- Parameters:
key
- The name of the session variablevalue
- The value of the session variable- Returns:
-
getSessionVariable
public javax.ws.rs.core.Response getSessionVariable(String key)
Gets the value of a session variable.- Parameters:
key
- The name of the session variable- Returns:
-
clearSessionVariable
public javax.ws.rs.core.Response clearSessionVariable(String key)
Deletes the value of a session variable.- Parameters:
key
- The name of the session variable- Returns:
-
registeredPlugins
public javax.ws.rs.core.Response registeredPlugins()
-
buildOkResponse
protected javax.ws.rs.core.Response buildOkResponse(Object entity)
-
-