public class UpdateFilter extends StartupFilter
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
AUTO_RUN_OPENMRS, errors, filterConfig, msgs, velocityEngine| Constructor and Description |
|---|
UpdateFilter() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
authenticateAsSuperUser(String usernameOrSystemId,
String password)
Look in the users table for a user with this username and password and see if they have a role of
RoleConstants.SUPERUSER. |
void |
checkLocaleAttributesForFirstTime(javax.servlet.http.HttpServletRequest httpRequest)
It sets locale attribute for current session when user is making first GET http request to
application.
|
protected void |
doGet(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Called by
StartupFilter.doFilter(ServletRequest, ServletResponse, FilterChain) on GET requests |
protected void |
doPost(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Called by
StartupFilter.doFilter(ServletRequest, ServletResponse, FilterChain) on POST requests |
protected String |
getTemplatePrefix()
This string is prepended to all templateNames passed to
StartupFilter.renderTemplate(String, Map, HttpServletResponse) |
protected Object |
getUpdateFilterModel()
The model that is used as the backer for all pages in this startup wizard.
|
void |
init(javax.servlet.FilterConfig filterConfig) |
static Boolean |
isLockReleased()
Indicates if database lock was released.
|
protected boolean |
isSuperUser(Connection connection,
Integer userId)
Checks the given user to see if they have been given the
RoleConstants.SUPERUSER
role. |
static void |
setLockReleased(Boolean lockReleased) |
static void |
setUpdatesRequired(boolean updatesRequired) |
boolean |
skipFilter(javax.servlet.http.HttpServletRequest httpRequest)
If this returns true, this filter fails early and quickly.
|
static boolean |
updatesRequired()
Used by the Listener to know if this filter wants to do its magic
|
addLogLinesToResponse, destroy, doFilter, getToolContext, renderTemplate, toJSONStringprotected void doGet(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
throws IOException,
javax.servlet.ServletException
StartupFilter.doFilter(ServletRequest, ServletResponse, FilterChain) on GET requestsdoGet in class StartupFilterhttpRequest - httpResponse - IOExceptionjavax.servlet.ServletExceptionprotected void doPost(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
throws IOException,
javax.servlet.ServletException
StartupFilter.doFilter(ServletRequest, ServletResponse, FilterChain) on POST requestsdoPost in class StartupFilterIOExceptionjavax.servlet.ServletExceptionStartupFilter.doPost(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)public void checkLocaleAttributesForFirstTime(javax.servlet.http.HttpServletRequest httpRequest)
Locale.ENGLISH by defaulthttpRequest - the http request objectprotected boolean authenticateAsSuperUser(String usernameOrSystemId, String password) throws javax.servlet.ServletException
RoleConstants.SUPERUSER.usernameOrSystemId - user entered usernamepassword - user entered passwordjavax.servlet.ServletExceptionShould return false if given invalid
credentials Should return false if given user is not superuser
Should return true if given user is superuser Should not
authorize retired superusers Should authenticate with systemIdprotected boolean isSuperUser(Connection connection, Integer userId) throws SQLException
RoleConstants.SUPERUSER
role. This method does not look at child roles.connection - the java sql connection to useuserId - the user id to look atSQLException - Should return true if given user has superuser role
Should return false if given user does not have the super user rolepublic void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
init in interface javax.servlet.Filterinit in class StartupFilterjavax.servlet.ServletExceptionFilter.init(javax.servlet.FilterConfig)protected Object getUpdateFilterModel()
StartupFiltergetUpdateFilterModel in class StartupFilterStartupFilter.getUpdateFilterModel()public boolean skipFilter(javax.servlet.http.HttpServletRequest httpRequest)
StartupFilterskipFilter in class StartupFilterStartupFilter.skipFilter(HttpServletRequest)public static boolean updatesRequired()
init(FilterConfig),
Listener.isSetupNeeded(),
Listener.contextInitialized(ServletContextEvent)public static void setUpdatesRequired(boolean updatesRequired)
updatesRequired - the updatesRequired to setpublic static Boolean isLockReleased()
public static void setLockReleased(Boolean lockReleased)
protected String getTemplatePrefix()
StartupFilterStartupFilter.renderTemplate(String, Map, HttpServletResponse)getTemplatePrefix in class StartupFilterStartupFilter.getTemplatePrefix()Copyright © 2024 OpenMRS Inc.. All rights reserved.