3 * Copyright (C) 2009-2024 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.server.v2.api.user.request;
22 import io.swagger.v3.oas.annotations.media.ArraySchema;
23 import io.swagger.v3.oas.annotations.media.Schema;
24 import java.util.List;
25 import javax.annotation.Nullable;
26 import javax.validation.constraints.Email;
27 import javax.validation.constraints.Size;
28 import org.sonar.server.v2.common.model.UpdateField;
30 public class UserUpdateRestRequest {
32 private UpdateField<String> login = UpdateField.undefined();
33 private UpdateField<String> name = UpdateField.undefined();
34 private UpdateField<String> email = UpdateField.undefined();
35 private UpdateField<List<String>> scmAccounts = UpdateField.undefined();
36 private UpdateField<String> externalProvider = UpdateField.undefined();
37 private UpdateField<String> externalLogin = UpdateField.undefined();
39 @Size(min = 2, max = 100)
40 @Schema(description = "User login")
41 public UpdateField<String> getLogin() {
45 public void setLogin(String login) {
46 this.login = UpdateField.withValue(login);
50 @Schema(description = "User first name and last name", implementation = String.class)
51 public UpdateField<String> getName() {
55 public void setName(String name) {
56 this.name = UpdateField.withValue(name);
60 @Size(min = 1, max = 100)
61 @Schema(implementation = String.class, description = "Email")
62 public UpdateField<String> getEmail() {
66 public void setEmail(String email) {
67 this.email = UpdateField.withValue(email);
70 @ArraySchema(arraySchema = @Schema(description = "List of SCM accounts."), schema = @Schema(implementation = String.class))
71 public UpdateField<List<String>> getScmAccounts() {
75 public void setScmAccounts(List<String> scmAccounts) {
76 this.scmAccounts = UpdateField.withValue(scmAccounts);
79 @Schema(implementation = String.class, description = "New external provider. Only authentication system installed are available. " +
80 "Use 'LDAP' identity provider for single server LDAP setup. " +
81 "Use 'LDAP_{serverKey}' identity provider for multiple LDAP servers setup. " +
82 "Warning: when this information has been updated for a user, the user will only be able to authenticate via the new identity provider. " +
83 "It is not possible to migrate external user to local one.")
84 public UpdateField<String> getExternalProvider() {
85 return externalProvider;
88 public void setExternalProvider(@Nullable String externalProvider) {
89 this.externalProvider = UpdateField.withValue(externalProvider);
92 @Size(min = 1, max = 255)
93 @Schema(implementation = String.class, description = "New external login, usually the login used in the authentication system. If not provided previous identity will be used.")
94 public UpdateField<String> getExternalLogin() {
98 public void setExternalLogin(@Nullable String externalLogin) {
99 this.externalLogin = UpdateField.withValue(externalLogin);