001/*
002 * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     bstefanescu
018 */
019package org.nuxeo.ecm.platform.usermanager;
020
021import java.io.Serializable;
022
023/**
024 * A class containing the configuration of an user principal instance. This class keeps the keys of the basic user
025 * fields.
026 *
027 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
028 */
029public class UserConfig implements Serializable {
030
031    private static final long serialVersionUID = 1L;
032
033    public static final UserConfig DEFAULT = new UserConfig();
034
035    /**
036     * The default key name for user id, configurable on the UserManager service
037     */
038    public static final String USERNAME_COLUMN = "username";
039
040    /**
041     * The default key name for user email, configurable on the UserManager service
042     */
043    public static final String EMAIL_COLUMN = "email";
044
045    public static final String FIRSTNAME_COLUMN = "firstName";
046
047    public static final String LASTNAME_COLUMN = "lastName";
048
049    public static final String COMPANY_COLUMN = "company";
050
051    public static final String PASSWORD_COLUMN = "password";
052
053    public static final String GROUPS_COLUMN = "groups";
054
055    /**
056     * @since 8.1
057     */
058    public static final String TENANT_ID_COLUMN = "tenantId";
059
060    public static final String SCHEMA_NAME = "user";
061
062    public String nameKey = USERNAME_COLUMN;
063
064    public String passwordKey = PASSWORD_COLUMN;
065
066    public String firstNameKey = FIRSTNAME_COLUMN;
067
068    public String lastNameKey = LASTNAME_COLUMN;
069
070    public String companyKey = COMPANY_COLUMN;
071
072    public String emailKey = EMAIL_COLUMN;
073
074    public String groupsKey = GROUPS_COLUMN;
075
076    /**
077     * @since 8.1
078     */
079    public String tenantIdKey = TENANT_ID_COLUMN;
080
081    public String schemaName = SCHEMA_NAME;
082
083    @Override
084    public UserConfig clone()
085    {
086        UserConfig usrCfg = new UserConfig();
087        usrCfg.companyKey = companyKey;
088        usrCfg.emailKey = emailKey;
089        usrCfg.firstNameKey = firstNameKey;
090        usrCfg.groupsKey = groupsKey;
091        usrCfg.lastNameKey = lastNameKey;
092        usrCfg.nameKey = nameKey;
093        usrCfg.passwordKey = passwordKey;
094        usrCfg.tenantIdKey = tenantIdKey;
095        usrCfg.schemaName = schemaName;
096
097        return usrCfg;
098    }
099
100}