<commit_before>﻿using Implem.Libraries.Utilities;
using Implem.Pleasanter.Libraries.DataSources;
using Implem.Pleasanter.Libraries.DataTypes;
using Implem.Pleasanter.Libraries.Security;
using System;
namespace Implem.Pleasanter.Libraries.Initializers
{
    public static class UsersInitializer
    {
        public static void Initialize()
        {
            if (Rds.ExecuteScalar_int(statements:
                Rds.SelectUsers(column: Rds.UsersColumn().UsersCount())) == 0)
            {
                Create(
                    1,
                    "Administrator",
                    "System Admin",
                    password: Passwords.Default().Sha<PASSWORD>Cng(),
                    passwordExpirationTime: new Time(DateTime.Now),
                    tenantAdmin: true);
                Create(
                    0,
                    "Anonymouse",
                    "Anonymouse",
                    disabled: true);
            }
        }

        private static void Create(
            int tenantId,
            string loginId,
            string name,
            bool disabled = false,
            string password = "",
            Time passwordExpirationTime = null,
            bool tenantAdmin = false)
        {
            Rds.ExecuteNonQuery(statements:
                Rds.InsertUsers(
                    param: Rds.UsersParam()
                        .TenantId(tenantId)
                        .LoginId(loginId)
                        .Disabled(disabled)
                        .Password(password)
                        .LastName(string.Empty)
                        .FirstName(name)
                        .DeptId(0)
                        .FirstAndLastNameOrder(1)
                        .PasswordExpirationTime(
                            passwordExpirationTime?.ToString(),
                            _using: passwordExpirationTime != null)
                        .TenantAdmin(tenantAdmin)));
        }<commit_msg>System Adminの氏名をLastName, FirstNameに区切って挿入する仕様に変更。<commit_after>﻿using Implem.Libraries.Utilities;
using Implem.Pleasanter.Libraries.DataSources;
using Implem.Pleasanter.Libraries.DataTypes;
using Implem.Pleasanter.Libraries.Security;
using System;
namespace Implem.Pleasanter.Libraries.Initializers
{
    public static class UsersInitializer
    {
        public static void Initialize()
        {
            if (Rds.ExecuteScalar_int(statements:
                Rds.SelectUsers(column: Rds.UsersColumn().UsersCount())) == 0)
            {
                Create(
                    1,
                    "Administrator",
                    "System",
                    "Admin",
                    password: Passwords.Default().Sha<PASSWORD>(),
                    passwordExpirationTime: new Time(DateTime.Now),
                    tenantAdmin: true);
                Create(
                    0,
                    "Anonymouse",
                    "Anonymouse",
                    string.Empty,
                    disabled: true);
            }
        }

        private static void Create(
            int tenantId,
            string loginId,
            string lastName,
            string firstName,
            bool disabled = false,
            string password = "",
            Time passwordExpirationTime = null,
            bool tenantAdmin = false)
        {
            Rds.ExecuteNonQuery(statements:
                Rds.InsertUsers(
                    param: Rds.UsersParam()
                        .TenantId(tenantId)
                        .LoginId(loginId)
                        .Disabled(disabled)
                        .Password(password)
                        .LastName(lastName)
                        .FirstName(firstName)
                        .DeptId(0)
                        .FirstAndLastNameOrder(1)
                        .PasswordExpirationTime(
                            passwordExpirationTime?.ToString(),
                            _using: passwordExpirationTime != null)
                        .TenantAdmin(tenantAdmin)));
        }
{'fraction_non_alphanumeric': 0.0769041769041769, 'fraction_numerical': 0.002457002457002457, 'mean_word_length': 1.1887096774193548, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '529935', 'n_tokens_mistral': 999, 'n_tokens_neox': 942, 'n_words': 169}