Merge "Document CreateEmail/PutEmail/ConfirmEmail classes"
This commit is contained in:
@@ -48,6 +48,26 @@ import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
/**
|
||||
* REST endpoint for registering a new email address for an account.
|
||||
*
|
||||
* <p>This REST endpoint handles {@code PUT
|
||||
* /accounts/<account-identifier>/emails/<email-identifier>} requests if the specified email doesn't
|
||||
* exist for the account yet. If it already exists, the request is handled by {@link PutEmail}.
|
||||
*
|
||||
* <p>Whether an email address can be registered for the account depends on whether the used {@link
|
||||
* Realm} supports this.
|
||||
*
|
||||
* <p>When a new email address is registered an email with a confirmation link is sent to that
|
||||
* address. Only when the receiver confirms the email by clicking on the confirmation link, the
|
||||
* email address is added to the account (see {@link
|
||||
* com.google.gerrit.server.restapi.config.ConfirmEmail}). Confirming an email address for an
|
||||
* account creates an external ID that links the email address to the account. An email address can
|
||||
* only be added to an account if it is not assigned to any other account yet.
|
||||
*
|
||||
* <p>In some cases it is allowed to skip the email confirmation and add the email directly (calling
|
||||
* user has 'Modify Account' capability or server is running in dev mode).
|
||||
*/
|
||||
@Singleton
|
||||
public class CreateEmail
|
||||
implements RestCollectionCreateView<AccountResource, AccountResource.Email, EmailInput> {
|
||||
|
@@ -21,6 +21,22 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.account.AccountResource;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
/**
|
||||
* REST endpoint for updating an existing email address of an account.
|
||||
*
|
||||
* <p>This REST endpoint handles {@code PUT
|
||||
* /accounts/<account-identifier>/emails/<email-identifier>} requests if the specified email address
|
||||
* already exists for the account. If it doesn't exist yet, the request is handled by {@link
|
||||
* CreateEmail}.
|
||||
*
|
||||
* <p>We do not support email address updates via this path, hence this REST endpoint always throws
|
||||
* a {@link ResourceConflictException} which results in a {@code 409 Conflict} response.
|
||||
*
|
||||
* <p>This REST endpoint solely exists to avoid user confusion if they create a new email address
|
||||
* with {@code PUT /accounts/<account-identifier>/emails/<email-identifier>} and then repeat the
|
||||
* same request. Without this REST endpoint the second request would fail with {@code 404 Not
|
||||
* Found}, which would be surprising to the user.
|
||||
*/
|
||||
@Singleton
|
||||
public class PutEmail implements RestModifyView<AccountResource.Email, EmailInput> {
|
||||
@Override
|
||||
|
@@ -32,6 +32,18 @@ import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
/**
|
||||
* REST endpoint to confirm an email address for an account.
|
||||
*
|
||||
* <p>This REST endpoint handles {@code PUT /config/server/email.confirm} requests.
|
||||
*
|
||||
* <p>When a user registers a new email address for their account (see {@link
|
||||
* com.google.gerrit.server.restapi.account.CreateEmail}) an email with a confirmation link is sent
|
||||
* to that address. When the receiver confirms the email by clicking on the confirmation link, this
|
||||
* REST endpoint is invoked and the email address is added to the account. Confirming an email
|
||||
* address for an account creates an external ID that links the email address to the account. An
|
||||
* email address can only be added to an account if it is not assigned to any other account yet.
|
||||
*/
|
||||
@Singleton
|
||||
public class ConfirmEmail implements RestModifyView<ConfigResource, Input> {
|
||||
public static class Input {
|
||||
|
Reference in New Issue
Block a user