Began implementing use profile manager framework
parent
188ecca4ab
commit
e8a960920f
|
@ -75,6 +75,8 @@ namespace ServerConsole
|
|||
|
||||
public abstract void Write(string Line) ;
|
||||
|
||||
public abstract string PasswdPrompt(string prompt);
|
||||
|
||||
// Displays a command prompt and waits for the user to enter a string, then returns that string
|
||||
public abstract string CmdPrompt(string prompt) ;
|
||||
|
||||
|
|
|
@ -110,6 +110,20 @@ namespace OpenGridServices
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
// Displays a prompt and waits for the user to enter a string, then returns that string
|
||||
// Done with no echo and suitable for passwords
|
||||
public override string PasswdPrompt(string prompt) {
|
||||
// FIXME: Needs to be better abstracted
|
||||
Log.WriteLine(prompt);
|
||||
this.Write(prompt);
|
||||
ConsoleColor oldfg=Console.ForegroundColor;
|
||||
Console.ForegroundColor=Console.BackgroundColor;
|
||||
string temp=Console.ReadLine();
|
||||
Console.ForegroundColor=oldfg;
|
||||
return temp;
|
||||
}
|
||||
|
||||
// Displays a command prompt and waits for the user to enter a string, then returns that string
|
||||
public override string CmdPrompt(string prompt) {
|
||||
this.Write(prompt);
|
||||
|
|
|
@ -45,11 +45,13 @@
|
|||
<include name="System" />
|
||||
<include name="System.Xml" />
|
||||
<include name="../common/bin/ServerConsole.dll" />
|
||||
<include name="../common/bin/libsecondlife.dll" />
|
||||
</references>
|
||||
<sources>
|
||||
<include name="../common/src/VersionInfo.cs" />
|
||||
<include name="../common/src/OGS-Console.cs" />
|
||||
<include name="src/ConsoleCmds.cs" />
|
||||
<include name="src/UserProfiles.cs" />
|
||||
<include name="src/Main.cs" />
|
||||
</sources>
|
||||
</csc>
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace OpenGridServices
|
|||
public string DefaultStartupMsg;
|
||||
public string DefaultAssetServer;
|
||||
public string DefaultUserServer;
|
||||
public UserProfileManager _profilemanager;
|
||||
|
||||
[STAThread]
|
||||
public static void Main( string[] args )
|
||||
|
@ -69,6 +70,18 @@ namespace OpenGridServices
|
|||
this.DefaultAssetServer=ServerConsole.MainConsole.Instance.CmdPrompt("Default asset server [no default] :");
|
||||
this.DefaultUserServer=ServerConsole.MainConsole.Instance.CmdPrompt("Default user server [no default] :");
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager");
|
||||
_profilemanager = new UserProfileManager();
|
||||
_profilemanager.InitUserProfiles();
|
||||
|
||||
string tempfirstname;
|
||||
string templastname;
|
||||
string tempMD5Passwd;
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please configure the grid god user:");
|
||||
tempfirstname=ServerConsole.MainConsole.Instance.CmdPrompt("First name: ");
|
||||
templastname=ServerConsole.MainConsole.Instance.CmdPrompt("Last name: ");
|
||||
tempMD5Passwd=ServerConsole.MainConsole.Instance.PasswdPrompt("Password: ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
Copyright (c) OpenSim project, http://osgrid.org/
|
||||
|
||||
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the <organization> nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
using ServerConsole;
|
||||
|
||||
namespace OpenGridServices
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class UserProfileManager {
|
||||
|
||||
private Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
|
||||
|
||||
public UserProfileManager() {
|
||||
}
|
||||
|
||||
public void InitUserProfiles() {
|
||||
// TODO: need to load from database
|
||||
}
|
||||
|
||||
public UserProfile GetProfileByName(string firstname, string lastname) {
|
||||
foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) {
|
||||
if((UserProfiles[UUID].firstname==firstname) && (UserProfiles[UUID].lastname==lastname)) return UserProfiles[UUID];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID) {
|
||||
return UserProfiles[ProfileLLUUID];
|
||||
}
|
||||
}
|
||||
|
||||
public class UserProfile {
|
||||
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public bool IsGridGod;
|
||||
public string MD5passwd;
|
||||
|
||||
public UserProfile() {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue