Ejemplo n.º 1
0
 public void Start(IConfigSource config, IRegistryCore registry)
 {
     m_Database = Framework.Utilities.DataManager.RequestPlugin<IAvatarData>();
     m_ArchiveService = registry.RequestModuleInterface<IAvatarAppearanceArchiver>();
     registry.RequestModuleInterface<ISimulationBase>()
             .EventManager.RegisterEventHandler("DeleteUserInformation", DeleteUserInformation);
 }
Ejemplo n.º 2
0
 public void Start(IConfigSource config, IRegistryCore registry)
 {
     m_Database       = Framework.Utilities.DataManager.RequestPlugin <IAvatarData> ();
     m_ArchiveService = registry.RequestModuleInterface <IAvatarAppearanceArchiver> ();
     registry.RequestModuleInterface <ISimulationBase> ()
     .EventManager.RegisterEventHandler("DeleteUserInformation", DeleteUserInformation);
 }
Ejemplo n.º 3
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>().InnerService;
            m_agentInfoService = registry.RequestModuleInterface<IAgentInfoService>().InnerService;
            m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>();
            m_InventoryService = registry.RequestModuleInterface<IInventoryService>();
            m_GridService = registry.RequestModuleInterface<IGridService>();
            m_AvatarService = registry.RequestModuleInterface<IAvatarService>().InnerService;
            m_FriendsService = registry.RequestModuleInterface<IFriendsService>();
            m_SimulationService = registry.RequestModuleInterface<ISimulationService>();
            m_AssetService = registry.RequestModuleInterface<IAssetService>().InnerService;
            m_LibraryService = registry.RequestModuleInterface<ILibraryService>();
            m_CapsService = registry.RequestModuleInterface<ICapsService>();
            m_ArchiveService = registry.RequestModuleInterface<IAvatarAppearanceArchiver>();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            LoginModules = WhiteCoreModuleLoader.PickupModules<ILoginModule>();
            foreach (ILoginModule module in LoginModules)
            {
                module.Initialize(this, m_config, registry);
            }

            MainConsole.Instance.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
        /// <summary>
        /// Creates the grid owner user on a clean startup.
        /// Sets user to 'Charter Meneber" and elevates to  "God" status
        /// </summary>
        void CreateGridOwnerUser()
        {
            string userName = "";
            string password, email, uuid;

            // Get user name
            // check for user name seed
            IConfig loginConfig = m_config.Configs ["LoginService"];

            if (loginConfig != null)
            {
                string userNameSeed = loginConfig.GetString("UserNameSeed", "");
                if (userNameSeed != "")
                {
                    m_userNameSeed = userNameSeed.Split(',');
                }
            }

            var ufNames = new Utilities.MarkovNameGenerator();
            var ulNames = new Utilities.MarkovNameGenerator();

            string [] nameSeed = m_userNameSeed == null ? Utilities.UserNames : m_userNameSeed;

            string firstName   = ufNames.FirstName(nameSeed, 3, 4);
            string lastName    = ulNames.FirstName(nameSeed, 5, 6);
            string enteredName = firstName + " " + lastName;

            if (userName != "")
            {
                enteredName = userName;
            }

            do
            {
                userName = MainConsole.Instance.Prompt("Grid owner user name (? for suggestion)", enteredName);
                if (userName == "" || userName == "?")
                {
                    enteredName = ufNames.NextName + " " + ulNames.NextName;
                    userName    = "";
                    continue;
                }
                var fl = userName.Split(' ');
                if (fl.Length < 2)
                {
                    MainConsole.Instance.CleanInfo("    User name must be <firstname> <lastname>");
                    userName = "";
                }
            } while (userName == "");
            ufNames.Reset();
            ulNames.Reset();

            // password
            var pwmatch = false;

            do
            {
                password = MainConsole.Instance.PasswordPrompt("Password");
                if (password == "")
                {
                    MainConsole.Instance.CleanInfo(" .... password must not be empty, please re-enter");
                    continue;
                }
                var passwordAgain = MainConsole.Instance.PasswordPrompt("Re-enter Password");
                pwmatch = (password == passwordAgain);
                if (!pwmatch)
                {
                    MainConsole.Instance.CleanInfo(" .... passwords did not match, please re-enter");
                }
            } while (!pwmatch);

            // email
            email = MainConsole.Instance.Prompt("Email for password recovery. ('none' if unknown)", "none");

            if ((email.ToLower() != "none") && !Utilities.IsValidEmail(email))
            {
                MainConsole.Instance.CleanInfo("This does not look like a valid email address. ('none' if unknown)");
                email = MainConsole.Instance.Prompt("Email", email);
            }

            // Get available user avatar archives
            var userAvatarArchive = "";
            IAvatarAppearanceArchiver avieArchiver = m_registry.RequestModuleInterface <IAvatarAppearanceArchiver> ();

            if (avieArchiver != null)
            {
                List <string> avatarArchives = avieArchiver.GetAvatarArchiveFilenames();

                if (avatarArchives.Count > 0)
                {
                    avatarArchives.Add("None");
                    userAvatarArchive = MainConsole.Instance.Prompt("Avatar archive to use", "None", avatarArchives);
                    if (userAvatarArchive == "None")
                    {
                        userAvatarArchive = "";
                    }
                }
            }

            // Allow the modification of UUID if required - for matching user UUID with other Grids etc like SL
            uuid = UUID.Random().ToString();
            while (true)
            {
                uuid = MainConsole.Instance.Prompt("Required avatar UUID (optional))", uuid);
                UUID test;
                if (UUID.TryParse(uuid, out test))
                {
                    break;
                }

                MainConsole.Instance.Error("There was a problem verifying this UUID. Please retry.");
            }

            // this really should not normally be altered so hide it
            //scopeID = UUID.Zero.ToString ();
            //if (sysFlag) {
            //    scopeID = MainConsole.Instance.Prompt ("Scope (Don't change unless you know what this is)", scopeID);
            //}

            // we should be good to go
            //m_accountService.CreateUser (UUID.Parse (uuid), UUID.Parse (scopeID), userName, Util.Md5Hash (password), email);
            m_accountService.CreateUser(UUID.Parse(uuid), UUID.Zero, userName, Util.Md5Hash(password), email);
            // CreateUser will tell us success or problem
            //MainConsole.Instance.InfoFormat("[User account service]: User '{0}' created", name);

            // check for success
            UserAccount account = m_accountService.GetUserAccount(null, userName);

            if (account != null)
            {
                account.UserFlags = Constants.USER_FLAG_CHARTERMEMBER;
                account.UserLevel = 250;
                m_accountService.StoreUserAccount(account);

                // update profile for the user as well
                var profileConnector = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector> ();
                if (profileConnector != null)
                {
                    var profile = profileConnector.GetUserProfile(account.PrincipalID);
                    if (profile == null)
                    {
                        profileConnector.CreateNewProfile(account.PrincipalID);           // create a profile for the user
                        profile = profileConnector.GetUserProfile(account.PrincipalID);
                    }

                    if (userAvatarArchive != "")
                    {
                        profile.AArchiveName = userAvatarArchive + ".aa";
                    }
                    profile.MembershipGroup = "Charter_Member";
                    profile.IsNewUser       = true;
                    profileConnector.UpdateUserProfile(profile);
                }
            }
            else
            {
                MainConsole.Instance.WarnFormat("[System User account service]: There was a problem creating the account for '{0}'", userName);
            }
        }