com.atlassian.confluence.user
Class DefaultSignupManager

java.lang.Object
  extended by com.atlassian.confluence.user.DefaultSignupManager
All Implemented Interfaces:
SignupManager

public class DefaultSignupManager
extends Object
implements SignupManager

Handles easy-user creation in its myriad forms.

Since:
v4.1

Field Summary
static String NOTIFY_ON_SIGNUP_TOKEN
           
static String PREVIOUS_SIGNUP_TOKEN
           
static String SIGNUP_TOKEN
           
 
Constructor Summary
DefaultSignupManager(com.atlassian.bandana.BandanaManager bandanaManager, com.atlassian.security.random.SecureTokenGenerator secureTokenGenerator, UserAccessor userAccessor, com.atlassian.crowd.embedded.api.CrowdService crowdService, SettingsManager settingsManager, com.atlassian.core.util.Clock clock, com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer, EmailService notificationsService, com.atlassian.event.api.EventPublisher eventPublisher, UserChecker userChecker, PersonalInformationManager personalInformationManager)
           
 
Method Summary
 boolean canSignUpWith(String token)
          Return true if the given token is valid for a user to self-sign-up.
 String createUserPendingConfirmation(com.atlassian.user.User user, String passw)
          Creates a new user and marks her disabled pending her email confirmation?
 boolean doesUserHaveOutdatedSignupToken(com.atlassian.user.User user)
           
 void enableConfirmedUser(com.atlassian.user.User user)
          Enable previously disabled user who signed up and confirmed her email.
 String getRelativeSignupURL()
           
 String getRestrictedDomains()
          Returns comma separated list of domains.
 String getSignUpToken()
          Gets the current sign-up token, or creates a new one and returns it.
 String getSignupURL()
           
 boolean isDomainRestrictedSignupEnabled()
           
 boolean isEmailSentOnInviteSignUp()
           
 boolean isPendingConfirmation(com.atlassian.user.User user)
          Is given user tried to sign up but hasn't confirmed her email yet?
 boolean isPublicSignupPermitted()
          Returns true if users can sign themselves for this instance.
 boolean isTokenForUserValid(com.atlassian.user.User user, String token)
           
 String refreshAndGetToken()
          Creates a new sign-up token and returns it.
 String restorePreviousToken()
          Restore the previous private-signup token and returns it.
 NotificationSendResult sendInvites(SendUserInviteEvent event)
          Send invitation emails with a message to a list of email addresses.
 void setDomainRestrictedSignupMode(String allowedDomains)
          Set the domains that user's email address should belong to to be able to sign up.
 void setEmailSentOnInviteSignUp(boolean notify)
           
 void setPrivateSignupMode()
           
 void setPublicSignupMode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGNUP_TOKEN

public static final String SIGNUP_TOKEN
See Also:
Constant Field Values

PREVIOUS_SIGNUP_TOKEN

public static final String PREVIOUS_SIGNUP_TOKEN
See Also:
Constant Field Values

NOTIFY_ON_SIGNUP_TOKEN

public static final String NOTIFY_ON_SIGNUP_TOKEN
See Also:
Constant Field Values
Constructor Detail

DefaultSignupManager

public DefaultSignupManager(com.atlassian.bandana.BandanaManager bandanaManager,
                            com.atlassian.security.random.SecureTokenGenerator secureTokenGenerator,
                            UserAccessor userAccessor,
                            com.atlassian.crowd.embedded.api.CrowdService crowdService,
                            SettingsManager settingsManager,
                            com.atlassian.core.util.Clock clock,
                            com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer,
                            EmailService notificationsService,
                            com.atlassian.event.api.EventPublisher eventPublisher,
                            UserChecker userChecker,
                            PersonalInformationManager personalInformationManager)
Method Detail

refreshAndGetToken

public String refreshAndGetToken()
Description copied from interface: SignupManager
Creates a new sign-up token and returns it. This invalidates the previous token.

Specified by:
refreshAndGetToken in interface SignupManager
Returns:
a random sign-up token

canSignUpWith

public boolean canSignUpWith(String token)
Description copied from interface: SignupManager
Return true if the given token is valid for a user to self-sign-up.

Specified by:
canSignUpWith in interface SignupManager
Parameters:
token - a sign-up token from a URL given to an invited user

isEmailSentOnInviteSignUp

public boolean isEmailSentOnInviteSignUp()
Specified by:
isEmailSentOnInviteSignUp in interface SignupManager
Returns:
true if notification emails should be sent to admins when a user signs themselves up.

isPublicSignupPermitted

public boolean isPublicSignupPermitted()
Description copied from interface: SignupManager
Returns true if users can sign themselves for this instance.

Specified by:
isPublicSignupPermitted in interface SignupManager

getRelativeSignupURL

public String getRelativeSignupURL()
Specified by:
getRelativeSignupURL in interface SignupManager

getSignupURL

public String getSignupURL()
Specified by:
getSignupURL in interface SignupManager

setEmailSentOnInviteSignUp

public void setEmailSentOnInviteSignUp(boolean notify)
Specified by:
setEmailSentOnInviteSignUp in interface SignupManager
Parameters:
notify - true if notification emails should be sent to admins when a user signs themselves up, false if not

restorePreviousToken

public String restorePreviousToken()
Description copied from interface: SignupManager
Restore the previous private-signup token and returns it.

Specified by:
restorePreviousToken in interface SignupManager

getSignUpToken

public String getSignUpToken()
Description copied from interface: SignupManager
Gets the current sign-up token, or creates a new one and returns it.

Specified by:
getSignUpToken in interface SignupManager
Returns:
a random sign-up token

sendInvites

public NotificationSendResult sendInvites(SendUserInviteEvent event)
Description copied from interface: SignupManager
Send invitation emails with a message to a list of email addresses.

Specified by:
sendInvites in interface SignupManager
Returns:
the number of emails sent

setPublicSignupMode

public void setPublicSignupMode()
Specified by:
setPublicSignupMode in interface SignupManager

setPrivateSignupMode

public void setPrivateSignupMode()
Specified by:
setPrivateSignupMode in interface SignupManager

setDomainRestrictedSignupMode

public void setDomainRestrictedSignupMode(String allowedDomains)
Description copied from interface: SignupManager
Set the domains that user's email address should belong to to be able to sign up.

Specified by:
setDomainRestrictedSignupMode in interface SignupManager
Parameters:
allowedDomains - comma separated list of domains

getRestrictedDomains

public String getRestrictedDomains()
Description copied from interface: SignupManager
Returns comma separated list of domains. Users with email in those domains are allowed to sign up. Provided domain restricted sign up is enabled.

Specified by:
getRestrictedDomains in interface SignupManager
Returns:
comma separated list of domains

isPendingConfirmation

public boolean isPendingConfirmation(com.atlassian.user.User user)
Description copied from interface: SignupManager
Is given user tried to sign up but hasn't confirmed her email yet?

Specified by:
isPendingConfirmation in interface SignupManager
Returns:
true if the given user tried to sign up but hasn't confirmed her email yet.

isTokenForUserValid

public boolean isTokenForUserValid(com.atlassian.user.User user,
                                   String token)
Specified by:
isTokenForUserValid in interface SignupManager
Returns:
true if given token a valid token that was issued when the given user tried to signup

doesUserHaveOutdatedSignupToken

public boolean doesUserHaveOutdatedSignupToken(com.atlassian.user.User user)
Specified by:
doesUserHaveOutdatedSignupToken in interface SignupManager
Returns:
true if a given user has tried to sign up but hasn't confirmed her email within a reasonable time (1 month)

enableConfirmedUser

public void enableConfirmedUser(com.atlassian.user.User user)
                         throws com.atlassian.crowd.exception.runtime.UserNotFoundException,
                                com.atlassian.crowd.exception.runtime.OperationFailedException,
                                com.atlassian.crowd.exception.InvalidUserException,
                                com.atlassian.crowd.exception.OperationNotPermittedException
Description copied from interface: SignupManager
Enable previously disabled user who signed up and confirmed her email.

Specified by:
enableConfirmedUser in interface SignupManager
Throws:
com.atlassian.crowd.exception.runtime.UserNotFoundException
com.atlassian.crowd.exception.runtime.OperationFailedException
com.atlassian.crowd.exception.InvalidUserException
com.atlassian.crowd.exception.OperationNotPermittedException

createUserPendingConfirmation

public String createUserPendingConfirmation(com.atlassian.user.User user,
                                            String passw)
                                     throws com.atlassian.crowd.exception.runtime.OperationFailedException,
                                            com.atlassian.crowd.exception.InvalidUserException,
                                            com.atlassian.crowd.exception.InvalidCredentialException,
                                            com.atlassian.crowd.exception.OperationNotPermittedException
Description copied from interface: SignupManager
Creates a new user and marks her disabled pending her email confirmation?

Specified by:
createUserPendingConfirmation in interface SignupManager
Returns:
the token that the user must validate against in order to confirm her email
Throws:
com.atlassian.crowd.exception.runtime.OperationFailedException
com.atlassian.crowd.exception.InvalidUserException
com.atlassian.crowd.exception.InvalidCredentialException
com.atlassian.crowd.exception.OperationNotPermittedException

isDomainRestrictedSignupEnabled

public boolean isDomainRestrictedSignupEnabled()
Specified by:
isDomainRestrictedSignupEnabled in interface SignupManager
Returns:
true if sign up is enabled only for some specified domains


Copyright © 2003-2013 Atlassian. All Rights Reserved.