Package org.nuxeo.ecm.user.invite
Class UserInvitationComponent
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.user.invite.UserInvitationComponent
-
- All Implemented Interfaces:
UserInvitationService
,Adaptable
,Component
,Extensible
,TimestampedService
public class UserInvitationComponent extends DefaultComponent implements UserInvitationService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
UserInvitationComponent.RegistrationAcceptator
protected class
UserInvitationComponent.RegistrationApprover
protected class
UserInvitationComponent.RegistrationCreator
protected class
UserInvitationComponent.RegistrationRejector
protected class
UserInvitationComponent.RequestIdValidator
protected class
UserInvitationComponent.RootDocumentGetter
protected class
UserInvitationComponent.UserRegistrationModelCreator
-
Nested classes/interfaces inherited from interface org.nuxeo.ecm.user.invite.UserInvitationService
UserInvitationService.ValidationMethod
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,UserRegistrationConfiguration>
configurations
protected static Log
log
static String
NUXEO_URL_KEY
static String
PARAM_ORIGINATING_USER
protected String
repoName
protected RenderingHelper
rh
protected String
testRendering
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Fields inherited from interface org.nuxeo.ecm.user.invite.UserInvitationService
REGISTRATION_CONFIGURATION_NAME, REGISTRATION_DATA_DOC, REGISTRATION_DATA_USER
-
-
Constructor Summary
Constructors Constructor Description UserInvitationComponent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptRegistrationRequest(String requestId, Map<String,Serializable> additionnalInfo)
accept the registration requestprotected String
buildEnterPasswordUrl(UserRegistrationConfiguration configuration)
void
checkRequestId(String requestId)
The method checks if the request id is a valid one.protected boolean
checkUserFromRegistrationExistence(DocumentModel registrationDoc)
NuxeoPrincipal
createUser(CoreSession session, DocumentModel registrationDoc)
void
deleteRegistrationRequests(CoreSession session, List<DocumentModel> registrationDocs)
Delete a registration documentprotected void
generateMail(String destination, String copy, String title, String content)
UserRegistrationConfiguration
getConfiguration()
UserRegistrationConfiguration
getConfiguration(String name)
Return specific configuration for the specified nameUserRegistrationConfiguration
getConfiguration(DocumentModel requestDoc)
Set<String>
getConfigurationsName()
List all registered onfiguration nameString
getNameEventRegistrationAccepted()
String
getNameEventRegistrationRejected()
String
getNameEventRegistrationSubmitted()
String
getNameEventRegistrationValidated()
DocumentModel
getOrCreateRootDocument(CoreSession session, String configurationName)
RegistrationRules
getRegistrationRules(String configurationName)
Get registration rules adapterDocumentModel
getRegistrationRulesDocument(CoreSession session, String configurationName)
Get documentmodel that stores request configuration using RegistrationConfiguration facet.DocumentModelList
getRegistrationsForUser(String docId, String username, String configurationName)
Retrieve registrations for a document givent the usernameprotected InvitationUserFactory
getRegistrationUserFactory(UserRegistrationConfiguration configuration)
protected String
getTargetRepositoryName()
String
getTestedRendering()
DocumentModel
getUserRegistrationModel(String configurationName)
Create a document model for the UserRegistration doctype.protected static boolean
isEmailExist(UserRegistrationConfiguration configuration, DocumentModel userRegistration)
protected static boolean
isTestModeSet()
void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
rejectRegistrationRequest(String requestId, Map<String,Serializable> additionnalInfo)
reject the registration requestprotected void
reviveRegistrationRequest(CoreSession session, DocumentModel registrationDoc, Map<String,Serializable> additionalInfos)
void
reviveRegistrationRequests(CoreSession session, List<DocumentModel> registrationDocs)
Send a mail to the invited user to revive his invitation If an error occured while sending an email, it logs it and continue.protected void
sendEmail(Map<String,Serializable> additionnalInfo, DocumentModel registrationDoc, String emailTemplatePath, String emailTitle)
protected EventContext
sendEvent(CoreSession session, DocumentModel source, String evName)
protected void
sendValidationEmail(Map<String,Serializable> additionnalInfo, DocumentModel registrationDoc)
String
submitRegistrationRequest(String configurationName, DocumentModel userRegistrationModel, Map<String,Serializable> additionnalInfo, UserInvitationService.ValidationMethod validationMethod, boolean autoAccept)
Stores a resgitration request like submitRegistrationRequest with Document informationString
submitRegistrationRequest(DocumentModel userRegistrationModel, Map<String,Serializable> additionnalInfo, UserInvitationService.ValidationMethod validationMethod, boolean autoAccept)
Stores a registration request and return a unique ID for itprotected boolean
userAlreadyExists(UserRegistrationInfo userRegistrationInfo)
Map<String,Serializable>
validateRegistration(String requestId, Map<String,Serializable> additionnalInfo)
Validate a registration request and generate the target UserMap<String,Serializable>
validateRegistrationAndSendEmail(String requestId, Map<String,Serializable> additionnalInfo)
Validate a registration request and generate the target User-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
PARAM_ORIGINATING_USER
public static final String PARAM_ORIGINATING_USER
- See Also:
- Constant Field Values
-
log
protected static Log log
-
NUXEO_URL_KEY
public static final String NUXEO_URL_KEY
- See Also:
- Constant Field Values
-
repoName
protected String repoName
-
testRendering
protected String testRendering
-
rh
protected RenderingHelper rh
-
configurations
protected Map<String,UserRegistrationConfiguration> configurations
-
-
Method Detail
-
getTestedRendering
public String getTestedRendering()
-
getTargetRepositoryName
protected String getTargetRepositoryName()
-
userAlreadyExists
protected boolean userAlreadyExists(UserRegistrationInfo userRegistrationInfo)
-
getUserRegistrationModel
public DocumentModel getUserRegistrationModel(String configurationName)
Description copied from interface:UserInvitationService
Create a document model for the UserRegistration doctype.- Specified by:
getUserRegistrationModel
in interfaceUserInvitationService
- Parameters:
configurationName
- The name of the configuration.- Returns:
- The document model
-
getRegistrationRulesDocument
public DocumentModel getRegistrationRulesDocument(CoreSession session, String configurationName)
Description copied from interface:UserInvitationService
Get documentmodel that stores request configuration using RegistrationConfiguration facet.- Specified by:
getRegistrationRulesDocument
in interfaceUserInvitationService
-
getOrCreateRootDocument
public DocumentModel getOrCreateRootDocument(CoreSession session, String configurationName)
-
sendEvent
protected EventContext sendEvent(CoreSession session, DocumentModel source, String evName) throws UserRegistrationException
- Throws:
UserRegistrationException
-
sendValidationEmail
protected void sendValidationEmail(Map<String,Serializable> additionnalInfo, DocumentModel registrationDoc)
-
sendEmail
protected void sendEmail(Map<String,Serializable> additionnalInfo, DocumentModel registrationDoc, String emailTemplatePath, String emailTitle)
-
isTestModeSet
protected static boolean isTestModeSet()
-
checkUserFromRegistrationExistence
protected boolean checkUserFromRegistrationExistence(DocumentModel registrationDoc)
-
generateMail
protected void generateMail(String destination, String copy, String title, String content) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
submitRegistrationRequest
public String submitRegistrationRequest(DocumentModel userRegistrationModel, Map<String,Serializable> additionnalInfo, UserInvitationService.ValidationMethod validationMethod, boolean autoAccept)
Description copied from interface:UserInvitationService
Stores a registration request and return a unique ID for it- Specified by:
submitRegistrationRequest
in interfaceUserInvitationService
-
getRegistrationsForUser
public DocumentModelList getRegistrationsForUser(String docId, String username, String configurationName)
Description copied from interface:UserInvitationService
Retrieve registrations for a document givent the username- Specified by:
getRegistrationsForUser
in interfaceUserInvitationService
-
isEmailExist
protected static boolean isEmailExist(UserRegistrationConfiguration configuration, DocumentModel userRegistration)
-
submitRegistrationRequest
public String submitRegistrationRequest(String configurationName, DocumentModel userRegistrationModel, Map<String,Serializable> additionnalInfo, UserInvitationService.ValidationMethod validationMethod, boolean autoAccept)
Description copied from interface:UserInvitationService
Stores a resgitration request like submitRegistrationRequest with Document information- Specified by:
submitRegistrationRequest
in interfaceUserInvitationService
- Returns:
- a unique ID for it
-
buildEnterPasswordUrl
protected String buildEnterPasswordUrl(UserRegistrationConfiguration configuration)
-
acceptRegistrationRequest
public void acceptRegistrationRequest(String requestId, Map<String,Serializable> additionnalInfo) throws UserRegistrationException
Description copied from interface:UserInvitationService
accept the registration request- Specified by:
acceptRegistrationRequest
in interfaceUserInvitationService
- Throws:
UserRegistrationException
-
rejectRegistrationRequest
public void rejectRegistrationRequest(String requestId, Map<String,Serializable> additionnalInfo) throws UserRegistrationException
Description copied from interface:UserInvitationService
reject the registration request- Specified by:
rejectRegistrationRequest
in interfaceUserInvitationService
- Throws:
UserRegistrationException
-
validateRegistration
public Map<String,Serializable> validateRegistration(String requestId, Map<String,Serializable> additionnalInfo) throws UserRegistrationException
Description copied from interface:UserInvitationService
Validate a registration request and generate the target User- Specified by:
validateRegistration
in interfaceUserInvitationService
- Throws:
UserRegistrationException
-
validateRegistrationAndSendEmail
public Map<String,Serializable> validateRegistrationAndSendEmail(String requestId, Map<String,Serializable> additionnalInfo) throws UserRegistrationException
Description copied from interface:UserInvitationService
Validate a registration request and generate the target User- Specified by:
validateRegistrationAndSendEmail
in interfaceUserInvitationService
- Throws:
UserRegistrationException
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
getRegistrationUserFactory
protected InvitationUserFactory getRegistrationUserFactory(UserRegistrationConfiguration configuration)
-
createUser
public NuxeoPrincipal createUser(CoreSession session, DocumentModel registrationDoc) throws UserRegistrationException
- Specified by:
createUser
in interfaceUserInvitationService
- Throws:
UserRegistrationException
-
getConfiguration
public UserRegistrationConfiguration getConfiguration()
- Specified by:
getConfiguration
in interfaceUserInvitationService
-
getConfiguration
public UserRegistrationConfiguration getConfiguration(DocumentModel requestDoc)
- Specified by:
getConfiguration
in interfaceUserInvitationService
-
getConfiguration
public UserRegistrationConfiguration getConfiguration(String name)
Description copied from interface:UserInvitationService
Return specific configuration for the specified name- Specified by:
getConfiguration
in interfaceUserInvitationService
- Parameters:
name
- configuration name
-
getRegistrationRules
public RegistrationRules getRegistrationRules(String configurationName)
Description copied from interface:UserInvitationService
Get registration rules adapter- Specified by:
getRegistrationRules
in interfaceUserInvitationService
-
reviveRegistrationRequests
public void reviveRegistrationRequests(CoreSession session, List<DocumentModel> registrationDocs)
Description copied from interface:UserInvitationService
Send a mail to the invited user to revive his invitation If an error occured while sending an email, it logs it and continue.- Specified by:
reviveRegistrationRequests
in interfaceUserInvitationService
-
reviveRegistrationRequest
protected void reviveRegistrationRequest(CoreSession session, DocumentModel registrationDoc, Map<String,Serializable> additionalInfos)
-
deleteRegistrationRequests
public void deleteRegistrationRequests(CoreSession session, List<DocumentModel> registrationDocs)
Description copied from interface:UserInvitationService
Delete a registration document- Specified by:
deleteRegistrationRequests
in interfaceUserInvitationService
-
getConfigurationsName
public Set<String> getConfigurationsName()
Description copied from interface:UserInvitationService
List all registered onfiguration name- Specified by:
getConfigurationsName
in interfaceUserInvitationService
-
checkRequestId
public void checkRequestId(String requestId) throws UserRegistrationException
Description copied from interface:UserInvitationService
The method checks if the request id is a valid one.- Specified by:
checkRequestId
in interfaceUserInvitationService
- Parameters:
requestId
- The value of the request id.- Throws:
UserRegistrationException
-
getNameEventRegistrationSubmitted
public String getNameEventRegistrationSubmitted()
- Specified by:
getNameEventRegistrationSubmitted
in interfaceUserInvitationService
- Returns:
- The name of the event when the registration is submitted.
-
getNameEventRegistrationAccepted
public String getNameEventRegistrationAccepted()
- Specified by:
getNameEventRegistrationAccepted
in interfaceUserInvitationService
- Returns:
- The name of the event when the registration is accepted.
-
getNameEventRegistrationRejected
public String getNameEventRegistrationRejected()
- Specified by:
getNameEventRegistrationRejected
in interfaceUserInvitationService
- Returns:
- The name of the event when the registration is rejected.
-
getNameEventRegistrationValidated
public String getNameEventRegistrationValidated()
- Specified by:
getNameEventRegistrationValidated
in interfaceUserInvitationService
- Returns:
- The name of the event when the registration is validated.
-
-