Class ProjectInvitationHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.members.ProjectInvitationHelper
-
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Component
,Configurable
,Contextualizable
,Serviceable
public class ProjectInvitationHelper extends AbstractLogEnabled implements Serviceable, Component, Configurable, PluginAware, Contextualizable
Helper for invitations by email
-
-
Constructor Summary
Constructors Constructor Description ProjectInvitationHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected I18nizableText
_getI18nizableText(String fullI18nKey, Map<String,I18nizableTextParameter> i18nParams)
Get theI18nizableText
from the configured key and i18n parametersvoid
configure(Configuration configuration)
void
contextualize(Context context)
void
createMemberFromInvitations(User user)
Add user as member of all project where it has been invitedString
getHtmlBodyForInvitationAcceptedEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email html body for invitation by emailString
getHtmlBodyForInvitationEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email html body for invitation by emailMap<String,Object>
getInvitationConfiguration(String projectName, String lang)
Get the configuration to invite users by emailsString
getSubjectForInvitationAcceptedEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email subject for invitation by emailString
getSubjectForInvitationEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email subject for invitation by emailString
getTextBodyForInvitationAcceptedEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email text body for invitation by emailString
getTextBodyForInvitationEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email text body for invitation by emailMap<String,Object>
inviteEmails(String projectName, String siteName, String lang, List<String> emails, Map<String,String> allowedProfileByModule, String mailSubject, String mailBody)
Invite emails to be member of a projectMap<String,Object>
inviteEmails(String projectName, List<String> emails, Map<String,String> allowedProfileByModule)
Invite emails to be member of a projectprotected void
sendInvitationAcceptedMail(Project project, User invitAuthor, User newMember)
Send email to the user who initiated the invitationvoid
service(ServiceManager serviceManager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Constructor Detail
-
ProjectInvitationHelper
public ProjectInvitationHelper()
-
-
Method Detail
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
inviteEmails
public Map<String,Object> inviteEmails(String projectName, List<String> emails, Map<String,String> allowedProfileByModule) throws UserManagementException, IllegalAccessException, NotUniqueUserException
Invite emails to be member of a project- Parameters:
projectName
- The project nameemails
- The emailsallowedProfileByModule
- the allowed profiles by module- Returns:
- The result
- Throws:
UserManagementException
- if failed to invit userNotUniqueUserException
- if many users match the given emailIllegalAccessException
- If the user cannot execute this operation
-
inviteEmails
public Map<String,Object> inviteEmails(String projectName, String siteName, String lang, List<String> emails, Map<String,String> allowedProfileByModule, String mailSubject, String mailBody) throws UserManagementException, IllegalAccessException, NotUniqueUserException
Invite emails to be member of a project- Parameters:
projectName
- The project namesiteName
- The site namelang
- the current languageemails
- The emailsallowedProfileByModule
- the allowed profiles by modulemailSubject
- The subject of mailmailBody
- The body of mail- Returns:
- The result
- Throws:
UserManagementException
- if failed to invit userNotUniqueUserException
- if many users match the given emailIllegalAccessException
- If the user cannot execute this operation
-
getInvitationConfiguration
public Map<String,Object> getInvitationConfiguration(String projectName, String lang)
Get the configuration to invite users by emails- Parameters:
projectName
- The current projectlang
- the current language- Returns:
- the configuration for email invitations
-
createMemberFromInvitations
public void createMemberFromInvitations(User user)
Add user as member of all project where it has been invited- Parameters:
user
- the new user
-
sendInvitationAcceptedMail
protected void sendInvitationAcceptedMail(Project project, User invitAuthor, User newMember)
Send email to the user who initiated the invitation- Parameters:
project
- The projectinvitAuthor
- The author of invitationnewMember
- The new member
-
getSubjectForInvitationEmail
public String getSubjectForInvitationEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email subject for invitation by email- Parameters:
defaultI18nParams
- The default i18n parameterslanguage
- the language- Returns:
- the email subject for invitation by email
-
getTextBodyForInvitationEmail
public String getTextBodyForInvitationEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email text body for invitation by email- Parameters:
defaultI18nParams
- The default i18n parameters with : siteName the site name email the mail token the token confirmUri the confirmation uri siteTitle the site title siteUrl the site urllanguage
- the language- Returns:
- the email text for invitation by email
-
getHtmlBodyForInvitationEmail
public String getHtmlBodyForInvitationEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email html body for invitation by email- Parameters:
defaultI18nParams
- The default i18n parameters with : siteName the site name email the mail token the token confirmUri the confirmation uri siteTitle the site title siteUrl the site urllanguage
- the language- Returns:
- the email html for invitation by email
-
getSubjectForInvitationAcceptedEmail
public String getSubjectForInvitationAcceptedEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email subject for invitation by email- Parameters:
defaultI18nParams
- The default i18n parameterslanguage
- the language- Returns:
- the email subject for invitation by email
-
getTextBodyForInvitationAcceptedEmail
public String getTextBodyForInvitationAcceptedEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email text body for invitation by email- Parameters:
defaultI18nParams
- The default i18n parameters with :language
- the language- Returns:
- the email text for invitation by email
-
getHtmlBodyForInvitationAcceptedEmail
public String getHtmlBodyForInvitationAcceptedEmail(Map<String,I18nizableTextParameter> defaultI18nParams, String language)
The email html body for invitation by email- Parameters:
defaultI18nParams
- The default i18n parameters with :language
- the language- Returns:
- the email html for invitation by email
-
_getI18nizableText
protected I18nizableText _getI18nizableText(String fullI18nKey, Map<String,I18nizableTextParameter> i18nParams)
Get theI18nizableText
from the configured key and i18n parameters- Parameters:
fullI18nKey
- the configured i18n keyi18nParams
- the i18n parameters- Returns:
- the i18nizable text
-
-