diff options
author | MW | 2007-03-28 18:10:52 +0000 |
---|---|---|
committer | MW | 2007-03-28 18:10:52 +0000 |
commit | 35fa85069e792579ebd44a974053d6dce288ea0a (patch) | |
tree | 8a5629c4f5e0a51e20a05123c4b1b9ea9f49f61e /OpenSim.Framework | |
parent | * log file name conflict (diff) | |
download | opensim-SC-35fa85069e792579ebd44a974053d6dce288ea0a.zip opensim-SC-35fa85069e792579ebd44a974053d6dce288ea0a.tar.gz opensim-SC-35fa85069e792579ebd44a974053d6dce288ea0a.tar.bz2 opensim-SC-35fa85069e792579ebd44a974053d6dce288ea0a.tar.xz |
After hours of searching for a bug, it works - User accounts in sandbox mode, currently they are not persistent between restarts (ie restarting opensim.exe) but should be persistent between sessions (login/ logout).
Use the -account command line arg to enable them and then create new accounts through the web interface
Diffstat (limited to 'OpenSim.Framework')
-rw-r--r-- | OpenSim.Framework/AgentInventory.cs | 59 | ||||
-rw-r--r-- | OpenSim.Framework/IUserServer.cs | 1 | ||||
-rw-r--r-- | OpenSim.Framework/UserProfile.cs | 1 | ||||
-rw-r--r-- | OpenSim.Framework/UserProfileManager.cs | 12 | ||||
-rw-r--r-- | OpenSim.Framework/UserProfileManagerBase.cs | 6 |
5 files changed, 71 insertions, 8 deletions
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs index 8ab2f3a..1abf59a 100644 --- a/OpenSim.Framework/AgentInventory.cs +++ b/OpenSim.Framework/AgentInventory.cs | |||
@@ -11,7 +11,7 @@ namespace OpenSim.Framework.Inventory | |||
11 | //Holds the local copy of Inventory info for a agent | 11 | //Holds the local copy of Inventory info for a agent |
12 | public Dictionary<LLUUID, InventoryFolder> InventoryFolders; | 12 | public Dictionary<LLUUID, InventoryFolder> InventoryFolders; |
13 | public Dictionary<LLUUID, InventoryItem> InventoryItems; | 13 | public Dictionary<LLUUID, InventoryItem> InventoryItems; |
14 | public InventoryFolder InventoryRoot; | 14 | public InventoryFolder InventoryRoot = new InventoryFolder(); |
15 | public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server | 15 | public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server |
16 | public LLUUID AgentID; | 16 | public LLUUID AgentID; |
17 | public AvatarWearable[] Wearables; | 17 | public AvatarWearable[] Wearables; |
@@ -30,14 +30,16 @@ namespace OpenSim.Framework.Inventory | |||
30 | { | 30 | { |
31 | Wearables[i] = new AvatarWearable(); | 31 | Wearables[i] = new AvatarWearable(); |
32 | } | 32 | } |
33 | 33 | ||
34 | InventoryRoot = new InventoryFolder(); | 34 | InventoryRoot = new InventoryFolder(); |
35 | InventoryRoot.FolderID = LLUUID.Random(); | 35 | InventoryRoot.FolderID = LLUUID.Random(); |
36 | InventoryRoot.ParentID = new LLUUID(); | 36 | InventoryRoot.ParentID = new LLUUID(); |
37 | InventoryRoot.Version = 1; | 37 | InventoryRoot.Version = 1; |
38 | InventoryRoot.DefaultType = 8; | 38 | InventoryRoot.DefaultType = 8; |
39 | InventoryRoot.OwnerID = this.AgentID; | ||
39 | InventoryRoot.FolderName = "My Inventory"; | 40 | InventoryRoot.FolderName = "My Inventory"; |
40 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); | 41 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); |
42 | |||
41 | } | 43 | } |
42 | 44 | ||
43 | public bool CreateNewFolder(LLUUID folderID, ushort type) | 45 | public bool CreateNewFolder(LLUUID folderID, ushort type) |
@@ -47,10 +49,61 @@ namespace OpenSim.Framework.Inventory | |||
47 | Folder.OwnerID = this.AgentID; | 49 | Folder.OwnerID = this.AgentID; |
48 | Folder.DefaultType = type; | 50 | Folder.DefaultType = type; |
49 | this.InventoryFolders.Add(Folder.FolderID, Folder); | 51 | this.InventoryFolders.Add(Folder.FolderID, Folder); |
52 | return (true); | ||
53 | } | ||
54 | |||
55 | public void CreateRootFolder(LLUUID newAgentID, bool createTextures) | ||
56 | { | ||
57 | this.AgentID = newAgentID; | ||
58 | /* InventoryRoot = new InventoryFolder(); | ||
59 | InventoryRoot.FolderID = LLUUID.Random(); | ||
60 | InventoryRoot.ParentID = new LLUUID(); | ||
61 | InventoryRoot.Version = 1; | ||
62 | InventoryRoot.DefaultType = 8; | ||
63 | InventoryRoot.OwnerID = this.AgentID; | ||
64 | InventoryRoot.FolderName = "My Inventory-"; | ||
65 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);*/ | ||
66 | InventoryRoot.OwnerID = this.AgentID; | ||
67 | if (createTextures) | ||
68 | { | ||
69 | this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName) | ||
74 | { | ||
75 | InventoryFolder Folder = new InventoryFolder(); | ||
76 | Folder.FolderID = folderID; | ||
77 | Folder.OwnerID = this.AgentID; | ||
78 | Folder.DefaultType = type; | ||
79 | Folder.FolderName = folderName; | ||
80 | this.InventoryFolders.Add(Folder.FolderID, Folder); | ||
81 | |||
82 | return (true); | ||
83 | } | ||
84 | |||
85 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent) | ||
86 | { | ||
87 | InventoryFolder Folder = new InventoryFolder(); | ||
88 | Folder.FolderID = folderID; | ||
89 | Folder.OwnerID = this.AgentID; | ||
90 | Folder.DefaultType = type; | ||
91 | Folder.FolderName = folderName; | ||
92 | Folder.ParentID = parent; | ||
93 | this.InventoryFolders.Add(Folder.FolderID, Folder); | ||
50 | 94 | ||
51 | return (true); | 95 | return (true); |
52 | } | 96 | } |
53 | 97 | ||
98 | public bool HasFolder(LLUUID folderID) | ||
99 | { | ||
100 | if (this.InventoryFolders.ContainsKey(folderID)) | ||
101 | { | ||
102 | return true; | ||
103 | } | ||
104 | return false; | ||
105 | } | ||
106 | |||
54 | public bool UpdateItem(LLUUID itemID, AssetBase asset) | 107 | public bool UpdateItem(LLUUID itemID, AssetBase asset) |
55 | { | 108 | { |
56 | if(this.InventoryItems.ContainsKey(itemID)) | 109 | if(this.InventoryItems.ContainsKey(itemID)) |
@@ -96,7 +149,7 @@ namespace OpenSim.Framework.Inventory | |||
96 | //public List<InventoryFolder> Subfolders; | 149 | //public List<InventoryFolder> Subfolders; |
97 | public LLUUID FolderID; | 150 | public LLUUID FolderID; |
98 | public LLUUID OwnerID; | 151 | public LLUUID OwnerID; |
99 | public LLUUID ParentID; | 152 | public LLUUID ParentID = LLUUID.Zero; |
100 | public string FolderName; | 153 | public string FolderName; |
101 | public ushort DefaultType; | 154 | public ushort DefaultType; |
102 | public ushort Version; | 155 | public ushort Version; |
diff --git a/OpenSim.Framework/IUserServer.cs b/OpenSim.Framework/IUserServer.cs index bb2b668..21f2721 100644 --- a/OpenSim.Framework/IUserServer.cs +++ b/OpenSim.Framework/IUserServer.cs | |||
@@ -10,5 +10,6 @@ namespace OpenSim.Framework.Interfaces | |||
10 | { | 10 | { |
11 | AgentInventory RequestAgentsInventory(LLUUID agentID); | 11 | AgentInventory RequestAgentsInventory(LLUUID agentID); |
12 | void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); | 12 | void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); |
13 | bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory); | ||
13 | } | 14 | } |
14 | } | 15 | } |
diff --git a/OpenSim.Framework/UserProfile.cs b/OpenSim.Framework/UserProfile.cs index 2c264c5..215f7da 100644 --- a/OpenSim.Framework/UserProfile.cs +++ b/OpenSim.Framework/UserProfile.cs | |||
@@ -32,6 +32,7 @@ namespace OpenSim.Framework.User | |||
32 | Circuits = new Dictionary<LLUUID, uint>(); | 32 | Circuits = new Dictionary<LLUUID, uint>(); |
33 | Inventory = new AgentInventory(); | 33 | Inventory = new AgentInventory(); |
34 | homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ; | 34 | homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ; |
35 | |||
35 | } | 36 | } |
36 | 37 | ||
37 | public void InitSessionData() | 38 | public void InitSessionData() |
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs index f77ca4c..d6304d0 100644 --- a/OpenSim.Framework/UserProfileManager.cs +++ b/OpenSim.Framework/UserProfileManager.cs | |||
@@ -68,6 +68,7 @@ namespace OpenSim.Framework.User | |||
68 | 68 | ||
69 | UserProfile TheUser = GetProfileByName(firstname, lastname); | 69 | UserProfile TheUser = GetProfileByName(firstname, lastname); |
70 | 70 | ||
71 | /* | ||
71 | if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null))) | 72 | if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null))) |
72 | { | 73 | { |
73 | XmlRpcResponse PresenceErrorResp = new XmlRpcResponse(); | 74 | XmlRpcResponse PresenceErrorResp = new XmlRpcResponse(); |
@@ -78,7 +79,7 @@ namespace OpenSim.Framework.User | |||
78 | PresenceErrorResp.Value = PresenceErrorRespData; | 79 | PresenceErrorResp.Value = PresenceErrorRespData; |
79 | return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "")); | 80 | return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "")); |
80 | 81 | ||
81 | } | 82 | }*/ |
82 | 83 | ||
83 | try | 84 | try |
84 | { | 85 | { |
@@ -116,6 +117,7 @@ namespace OpenSim.Framework.User | |||
116 | ArrayList ClassifiedCategories = new ArrayList(); | 117 | ArrayList ClassifiedCategories = new ArrayList(); |
117 | ClassifiedCategories.Add(ClassifiedCategoriesHash); | 118 | ClassifiedCategories.Add(ClassifiedCategoriesHash); |
118 | 119 | ||
120 | Console.WriteLine("copying inventory data to response"); | ||
119 | ArrayList AgentInventory = new ArrayList(); | 121 | ArrayList AgentInventory = new ArrayList(); |
120 | foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) | 122 | foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) |
121 | { | 123 | { |
@@ -142,7 +144,7 @@ namespace OpenSim.Framework.User | |||
142 | uint circode = (uint)(Util.RandomClass.Next()); | 144 | uint circode = (uint)(Util.RandomClass.Next()); |
143 | //TheUser.AddSimCircuit(circode, SimInfo.UUID); | 145 | //TheUser.AddSimCircuit(circode, SimInfo.UUID); |
144 | 146 | ||
145 | LoginGoodData["last_name"] = "\"" + TheUser.firstname + "\""; | 147 | LoginGoodData["last_name"] = "\"" + TheUser.lastname + "\""; |
146 | LoginGoodData["ui-config"] = ui_config; | 148 | LoginGoodData["ui-config"] = ui_config; |
147 | LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString(); | 149 | LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString(); |
148 | LoginGoodData["login-flags"] = LoginFlags; | 150 | LoginGoodData["login-flags"] = LoginFlags; |
@@ -160,7 +162,7 @@ namespace OpenSim.Framework.User | |||
160 | LoginGoodData["start_location"] = "last"; | 162 | LoginGoodData["start_location"] = "last"; |
161 | LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}"; | 163 | LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}"; |
162 | LoginGoodData["message"] = DefaultStartupMsg; | 164 | LoginGoodData["message"] = DefaultStartupMsg; |
163 | LoginGoodData["first_name"] = "\"" + firstname + "\""; | 165 | LoginGoodData["first_name"] = "\"" + TheUser.firstname + "\""; |
164 | LoginGoodData["circuit_code"] = (Int32)circode; | 166 | LoginGoodData["circuit_code"] = (Int32)circode; |
165 | LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port; | 167 | LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port; |
166 | LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated(); | 168 | LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated(); |
@@ -196,8 +198,8 @@ namespace OpenSim.Framework.User | |||
196 | SimProfile SimInfo = new SimProfile(); | 198 | SimProfile SimInfo = new SimProfile(); |
197 | //get siminfo from grid server | 199 | //get siminfo from grid server |
198 | SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); | 200 | SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); |
199 | uint circode = (uint)response["circuit_code"]; | 201 | Int32 circode = (Int32)response["circuit_code"]; |
200 | theUser.AddSimCircuit(circode, SimInfo.UUID); | 202 | theUser.AddSimCircuit((uint)circode, SimInfo.UUID); |
201 | response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; | 203 | response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; |
202 | response["sim_ip"] = SimInfo.sim_ip.ToString(); | 204 | response["sim_ip"] = SimInfo.sim_ip.ToString(); |
203 | response["sim_port"] = (Int32)SimInfo.sim_port; | 205 | response["sim_port"] = (Int32)SimInfo.sim_port; |
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs index ad03bc2..218a98c 100644 --- a/OpenSim.Framework/UserProfileManagerBase.cs +++ b/OpenSim.Framework/UserProfileManagerBase.cs | |||
@@ -41,19 +41,23 @@ namespace OpenSim.Framework.User | |||
41 | public virtual bool AuthenticateUser(string firstname, string lastname, string passwd) | 41 | public virtual bool AuthenticateUser(string firstname, string lastname, string passwd) |
42 | { | 42 | { |
43 | UserProfile TheUser = GetProfileByName(firstname, lastname); | 43 | UserProfile TheUser = GetProfileByName(firstname, lastname); |
44 | passwd = passwd.Remove(0, 3); //remove $1$ | ||
44 | if (TheUser != null) | 45 | if (TheUser != null) |
45 | { | 46 | { |
46 | if (TheUser.MD5passwd == passwd) | 47 | if (TheUser.MD5passwd == passwd) |
47 | { | 48 | { |
49 | Console.WriteLine("UserProfile - authorised "); | ||
48 | return true; | 50 | return true; |
49 | } | 51 | } |
50 | else | 52 | else |
51 | { | 53 | { |
54 | Console.WriteLine("UserProfile - not authorised, password not match "+ TheUser.MD5passwd +" and "+ passwd); | ||
52 | return false; | 55 | return false; |
53 | } | 56 | } |
54 | } | 57 | } |
55 | else | 58 | else |
56 | { | 59 | { |
60 | Console.WriteLine("UserProfile - not authorised , unkown: "+ firstname +" , " + lastname); | ||
57 | return false; | 61 | return false; |
58 | } | 62 | } |
59 | 63 | ||
@@ -66,12 +70,14 @@ namespace OpenSim.Framework.User | |||
66 | 70 | ||
67 | public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) | 71 | public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) |
68 | { | 72 | { |
73 | Console.WriteLine("creating new profile for : " + firstname + " , " + lastname); | ||
69 | UserProfile newprofile = new UserProfile(); | 74 | UserProfile newprofile = new UserProfile(); |
70 | newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); | 75 | newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); |
71 | newprofile.firstname = firstname; | 76 | newprofile.firstname = firstname; |
72 | newprofile.lastname = lastname; | 77 | newprofile.lastname = lastname; |
73 | newprofile.MD5passwd = MD5passwd; | 78 | newprofile.MD5passwd = MD5passwd; |
74 | newprofile.UUID = LLUUID.Random(); | 79 | newprofile.UUID = LLUUID.Random(); |
80 | newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); | ||
75 | this.UserProfiles.Add(newprofile.UUID, newprofile); | 81 | this.UserProfiles.Add(newprofile.UUID, newprofile); |
76 | return newprofile; | 82 | return newprofile; |
77 | } | 83 | } |