Package org.opencms.jsp.userdata
Class CmsUserDataRequestManager
java.lang.Object
org.opencms.jsp.userdata.CmsUserDataRequestManager
Manager class for user data requests.
Users can request their data either via username/password, in which case the user data will be collected for that user, or by email, in which case the data for all users with the given email address is collected.
User data is formatted as HTML by one or more configurable 'user data domain' classes, which implement the I_CmsUserDataDomain interface.
After the user requests their data, they are sent an email with a link (which is only valid for a certain time). When opening that link, they have to confirm the credentials they requested the data with, and if they successfully do so, are shown a page with their user data.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Attribute to enable/disable autoloading of plugins via service loader.static final String
The name that must be used for the function detail pages for user data requests.static final String
Tag name for the user data request manager.static final String
Tag name for the user data domain. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDigesterRules
(org.apache.commons.digester3.Digester digester, String basePath) Adds digester rules for configuration.void
addUserDataDomain
(I_CmsUserDataDomain domain) Adds a user data domain during configuration phase.void
appendToXml
(org.dom4j.Element element) Writes the configuration back to XML.void
Checks that the manager has not already been initialized, and throws an exception otherwise.Gets the list of all user data domains, both those from the configuration and those loaded via service loader.boolean
getInfoForEmail
(CmsObject cms, I_CmsUserDataDomain.Mode mode, String email, List<String> searchStrings, org.jsoup.nodes.Element root, I_CmsReport report) Gets the user data for an email address.boolean
getInfoForUser
(CmsObject cms, I_CmsUserDataDomain.Mode mode, CmsUser user, org.jsoup.nodes.Element root, I_CmsReport report) Gets the user data for a specific OpenCms user.Gets the user data request store.getUsersByEmail
(CmsObject cms, String email) Gets all users with a given email address (maximum of 999).void
initialize
(CmsObject cms) Initializes the manager.loadConfig
(CmsObject cms, String path) Loads the user data request configuration from the given file.protected void
setAutoload
(boolean autoload) Sets the autoload flag, which enables automatic loading of plugins via service loader.void
startUserDataRequest
(CmsObject cms, CmsUserDataRequestConfig config, String email) Starts a user data request for the email case.void
startUserDataRequest
(CmsObject cms, CmsUserDataRequestConfig config, CmsUser user) Starts a user data request for the single user case (with user name and password).toString()
-
Field Details
-
FUNCTION_NAME
The name that must be used for the function detail pages for user data requests.- See Also:
-
N_USERDATA
Tag name for the user data request manager.- See Also:
-
A_AUTOLOAD
Attribute to enable/disable autoloading of plugins via service loader.- See Also:
-
N_USERDATA_DOMAIN
Tag name for the user data domain.- See Also:
-
-
Constructor Details
-
CmsUserDataRequestManager
public CmsUserDataRequestManager()
-
-
Method Details
-
addDigesterRules
public static void addDigesterRules(org.apache.commons.digester3.Digester digester, String basePath) Adds digester rules for configuration.- Parameters:
digester
- the digesterbasePath
- the base xpath for the configuration of user data requests
-
getUsersByEmail
Gets all users with a given email address (maximum of 999).- Parameters:
cms
- the CMS contextemail
- the email address- Returns:
- the list of users
- Throws:
CmsException
- if something goes wrong
-
addUserDataDomain
Adds a user data domain during configuration phase.- Parameters:
domain
- the user data domain to add
-
appendToXml
Writes the configuration back to XML.- Parameters:
element
- the parent element
-
checkNotInitialized
Checks that the manager has not already been initialized, and throws an exception otherwise. -
getAllDomains
Gets the list of all user data domains, both those from the configuration and those loaded via service loader.- Returns:
- the list of all user data domains
-
getInfoForEmail
public boolean getInfoForEmail(CmsObject cms, I_CmsUserDataDomain.Mode mode, String email, List<String> searchStrings, org.jsoup.nodes.Element root, I_CmsReport report) throws CmsException Gets the user data for an email address.Only callable by root admin users.
- Parameters:
cms
- the CMS contextmode
- the modeemail
- the email address (may be null)searchStrings
- a list of additional search strings entered by the userroot
- the root element to which the report should be addedreport
- the report to write to- Returns:
- true if the HTML document was changed as a result of executing this method
- Throws:
CmsException
- if something goes wrong
-
getInfoForUser
public boolean getInfoForUser(CmsObject cms, I_CmsUserDataDomain.Mode mode, CmsUser user, org.jsoup.nodes.Element root, I_CmsReport report) throws CmsException Gets the user data for a specific OpenCms user.Only callable by root admin users.
- Parameters:
cms
- the CMS contextmode
- the modeuser
- the OpenCms userroot
- the root element to which the report should be addedreport
- the report to write to- Returns:
- true if the HTML document was changed as a result of executing this method
- Throws:
CmsException
- if something goes wrong
-
getRequestStore
Gets the user data request store.- Returns:
- the user data request store
-
initialize
Initializes the manager.- Parameters:
cms
- a CMS context with admin privileges
-
loadConfig
Loads the user data request configuration from the given file.Returns null if no configuration is found.
- Parameters:
cms
- the CMS contextpath
- the site path of the configuration- Returns:
- the configuration for the given path
-
startUserDataRequest
public void startUserDataRequest(CmsObject cms, CmsUserDataRequestConfig config, CmsUser user) throws javax.mail.internet.AddressException, org.apache.commons.mail.EmailException Starts a user data request for the single user case (with user name and password).- Parameters:
cms
- the CMS contextconfig
- the configurationuser
- the user for which the data was requested- Throws:
javax.mail.internet.AddressException
- if parsing the email address failsorg.apache.commons.mail.EmailException
- if sending the email fails
-
startUserDataRequest
public void startUserDataRequest(CmsObject cms, CmsUserDataRequestConfig config, String email) throws CmsUserDataRequestException, org.apache.commons.mail.EmailException, javax.mail.internet.AddressException Starts a user data request for the email case.- Parameters:
cms
- the CMS contextconfig
- the user data request configurationemail
- the email address- Throws:
CmsUserDataRequestException
- if something goes wrongorg.apache.commons.mail.EmailException
- if sending the email failsjavax.mail.internet.AddressException
- if parsing the email address fails
-
toString
-
setAutoload
Sets the autoload flag, which enables automatic loading of plugins via service loader.- Parameters:
autoload
- the value of the autoload flag
-