aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs81
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs2
7 files changed, 80 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 9a97925..a77646c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -50,6 +50,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 IUserManagement m_uMan;
54 IUserManagement UserManagementModule
55 {
56 get
57 {
58 if (m_uMan == null)
59 m_uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
60 return m_uMan;
61 }
62 }
63
53 #region ISharedRegionModule 64 #region ISharedRegionModule
54 public override string Name 65 public override string Name
55 { 66 {
@@ -369,9 +380,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
369 protected override FriendInfo[] GetFriendsFromService(IClientAPI client) 380 protected override FriendInfo[] GetFriendsFromService(IClientAPI client)
370 { 381 {
371// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); 382// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
383 Boolean agentIsLocal = true;
384 if (UserManagementModule != null)
385 agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId);
372 386
373 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId); 387 if (agentIsLocal)
374 if (account1 != null)
375 return base.GetFriendsFromService(client); 388 return base.GetFriendsFromService(client);
376 389
377 FriendInfo[] finfos = new FriendInfo[0]; 390 FriendInfo[] finfos = new FriendInfo[0];
@@ -392,16 +405,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
392 405
393 protected override bool StoreRights(UUID agentID, UUID friendID, int rights) 406 protected override bool StoreRights(UUID agentID, UUID friendID, int rights)
394 { 407 {
395 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 408 Boolean agentIsLocal = true;
396 UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 409 Boolean friendIsLocal = true;
410 if (UserManagementModule != null)
411 {
412 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
413 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
414 }
415
397 // Are they both local users? 416 // Are they both local users?
398 if (account1 != null && account2 != null) 417 if (agentIsLocal && friendIsLocal)
399 { 418 {
400 // local grid users 419 // local grid users
401 return base.StoreRights(agentID, friendID, rights); 420 return base.StoreRights(agentID, friendID, rights);
402 } 421 }
403 422
404 if (account1 != null) // agent is local, friend is foreigner 423 if (agentIsLocal) // agent is local, friend is foreigner
405 { 424 {
406 FriendInfo[] finfos = GetFriends(agentID); 425 FriendInfo[] finfos = GetFriends(agentID);
407 FriendInfo finfo = GetFriend(finfos, friendID); 426 FriendInfo finfo = GetFriend(finfos, friendID);
@@ -412,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
412 } 431 }
413 } 432 }
414 433
415 if (account2 != null) // agent is foreigner, friend is local 434 if (friendIsLocal) // agent is foreigner, friend is local
416 { 435 {
417 string agentUUI = GetUUI(friendID, agentID); 436 string agentUUI = GetUUI(friendID, agentID);
418 if (agentUUI != string.Empty) 437 if (agentUUI != string.Empty)
@@ -427,10 +446,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
427 446
428 protected override void StoreBackwards(UUID friendID, UUID agentID) 447 protected override void StoreBackwards(UUID friendID, UUID agentID)
429 { 448 {
430 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 449 Boolean agentIsLocal = true;
431 UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 450 Boolean friendIsLocal = true;
451 if (UserManagementModule != null)
452 {
453 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
454 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
455 }
456
432 // Are they both local users? 457 // Are they both local users?
433 if (account1 != null && account2 != null) 458 if (agentIsLocal && friendIsLocal)
434 { 459 {
435 // local grid users 460 // local grid users
436 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); 461 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -444,10 +469,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
444 469
445 protected override void StoreFriendships(UUID agentID, UUID friendID) 470 protected override void StoreFriendships(UUID agentID, UUID friendID)
446 { 471 {
447 UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 472 Boolean agentIsLocal = true;
448 UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 473 Boolean friendIsLocal = true;
474 if (UserManagementModule != null)
475 {
476 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
477 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
478 }
479
449 // Are they both local users? 480 // Are they both local users?
450 if (agentAccount != null && friendAccount != null) 481 if (agentIsLocal && friendIsLocal)
451 { 482 {
452 // local grid users 483 // local grid users
453 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); 484 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -465,13 +496,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
465 string agentFriendService = string.Empty; 496 string agentFriendService = string.Empty;
466 string friendFriendService = string.Empty; 497 string friendFriendService = string.Empty;
467 498
468 if (agentClient != null) 499 if (agentIsLocal)
469 { 500 {
470 agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); 501 agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode);
471 agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); 502 agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit);
472 agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); 503 agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString();
473 } 504 }
474 if (friendClient != null) 505 if (friendIsLocal)
475 { 506 {
476 friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); 507 friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode);
477 friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); 508 friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit);
@@ -484,7 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
484 // Generate a random 8-character hex number that will sign this friendship 515 // Generate a random 8-character hex number that will sign this friendship
485 string secret = UUID.Random().ToString().Substring(0, 8); 516 string secret = UUID.Random().ToString().Substring(0, 8);
486 517
487 if (agentAccount != null) // agent is local, 'friend' is foreigner 518 if (agentIsLocal) // agent is local, 'friend' is foreigner
488 { 519 {
489 // This may happen when the agent returned home, in which case the friend is not there 520 // This may happen when the agent returned home, in which case the friend is not there
490 // We need to look for its information in the friends list itself 521 // We need to look for its information in the friends list itself
@@ -520,7 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
520 friendsConn.NewFriendship(friendID, agentUUI + ";" + secret); 551 friendsConn.NewFriendship(friendID, agentUUI + ";" + secret);
521 } 552 }
522 } 553 }
523 else if (friendAccount != null) // 'friend' is local, agent is foreigner 554 else if (friendIsLocal) // 'friend' is local, agent is foreigner
524 { 555 {
525 // store in the local friends service a reference to the foreign agent 556 // store in the local friends service a reference to the foreign agent
526 FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); 557 FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1);
@@ -553,10 +584,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
553 584
554 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) 585 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID)
555 { 586 {
556 UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 587 Boolean agentIsLocal = true;
557 UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, exfriendID); 588 Boolean friendIsLocal = true;
589 if (UserManagementModule != null)
590 {
591 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
592 friendIsLocal = UserManagementModule.IsLocalGridUser(exfriendID);
593 }
594
558 // Are they both local users? 595 // Are they both local users?
559 if (agentAccount != null && friendAccount != null) 596 if (agentIsLocal && friendIsLocal)
560 { 597 {
561 // local grid users 598 // local grid users
562 return base.DeleteFriendship(agentID, exfriendID); 599 return base.DeleteFriendship(agentID, exfriendID);
@@ -566,7 +603,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
566 string agentUUI = string.Empty; 603 string agentUUI = string.Empty;
567 string friendUUI = string.Empty; 604 string friendUUI = string.Empty;
568 605
569 if (agentAccount != null) // agent is local, 'friend' is foreigner 606 if (agentIsLocal) // agent is local, 'friend' is foreigner
570 { 607 {
571 // We need to look for its information in the friends list itself 608 // We need to look for its information in the friends list itself
572 FriendInfo[] finfos = GetFriends(agentID); 609 FriendInfo[] finfos = GetFriends(agentID);
@@ -587,7 +624,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
587 return true; 624 return true;
588 } 625 }
589 } 626 }
590 else if (friendAccount != null) // agent is foreigner, 'friend' is local 627 else if (friendIsLocal) // agent is foreigner, 'friend' is local
591 { 628 {
592 agentUUI = GetUUI(exfriendID, agentID); 629 agentUUI = GetUUI(exfriendID, agentID);
593 630
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 560d913..bf1d787 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -180,10 +180,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
180 180
181// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 181// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
182 // Is the user a local user? 182 // Is the user a local user?
183 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID);
184 string url = string.Empty; 183 string url = string.Empty;
185 bool foreigner = false; 184 bool foreigner = false;
186 if (account == null) // foreign user 185 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(toAgentID)) // foreign user
187 { 186 {
188 url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); 187 url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI");
189 foreigner = true; 188 foreigner = true;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 841363c..8d41728 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -187,8 +187,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
187 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); 187 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
188 188
189 // Let's find out if this is a foreign user or a local user 189 // Let's find out if this is a foreign user or a local user
190 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, id); 190 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
191 if (account != null) 191 if (uMan != null && uMan.IsLocalGridUser(id))
192 { 192 {
193 // local grid user 193 // local grid user
194 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); 194 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local");
@@ -313,8 +313,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
313 } 313 }
314 314
315 // Let's find out if this is a foreign user or a local user 315 // Let's find out if this is a foreign user or a local user
316 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
316 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); 317 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
317 if (account != null) 318 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
318 { 319 {
319 // local grid user 320 // local grid user
320 return; 321 return;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 49d484b..bf24ebc 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -124,8 +124,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
124 124
125 protected override string GenerateLandmark(ScenePresence presence, out string prefix, out string suffix) 125 protected override string GenerateLandmark(ScenePresence presence, out string prefix, out string suffix)
126 { 126 {
127 UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, presence.UUID); 127 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(presence.UUID))
128 if (account == null)
129 prefix = "HG "; 128 prefix = "HG ";
130 else 129 else
131 prefix = string.Empty; 130 prefix = string.Empty;
@@ -210,12 +209,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
210 public override bool IsForeignUser(UUID userID, out string assetServerURL) 209 public override bool IsForeignUser(UUID userID, out string assetServerURL)
211 { 210 {
212 assetServerURL = string.Empty; 211 assetServerURL = string.Empty;
213 UserAccount account = null;
214 if (m_Scene.UserAccountService != null)
215 account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
216 212
217 if (account == null) // foreign 213 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID))
218 { 214 { // foreign
219 ScenePresence sp = null; 215 ScenePresence sp = null;
220 if (m_Scene.TryGetScenePresence(userID, out sp)) 216 if (m_Scene.TryGetScenePresence(userID, out sp))
221 { 217 {
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a40a6a4..dbe2560 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -425,6 +425,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
425 425
426 //} 426 //}
427 427
428 public bool IsLocalGridUser(UUID uuid)
429 {
430 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
431 if (account == null || (account != null && !account.LocalToGrid))
432 return false;
433
434 return true;
435 }
436
428 #endregion IUserManagement 437 #endregion IUserManagement
429 438
430 private void HandleShowUsers(string module, string[] cmd) 439 private void HandleShowUsers(string module, string[] cmd)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 0d121ed..b5c0af6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -218,9 +218,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
218 /// <param name="userID"></param> 218 /// <param name="userID"></param>
219 private void CacheInventoryServiceURL(UUID userID) 219 private void CacheInventoryServiceURL(UUID userID)
220 { 220 {
221 if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null) 221 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID))
222 { 222 {
223 // The user does not have a local account; let's cache its service URL 223 // The user is not local; let's cache its service URL
224 string inventoryURL = string.Empty; 224 string inventoryURL = string.Empty;
225 ScenePresence sp = null; 225 ScenePresence sp = null;
226 foreach (Scene scene in m_Scenes) 226 foreach (Scene scene in m_Scenes)
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index c66e053..ea0ba59 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -48,5 +48,7 @@ namespace OpenSim.Region.Framework.Interfaces
48 /// <param name="firstName"></param> 48 /// <param name="firstName"></param>
49 /// <param name="profileURL"></param> 49 /// <param name="profileURL"></param>
50 void AddUser(UUID uuid, string firstName, string lastName, string profileURL); 50 void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
51
52 bool IsLocalGridUser(UUID uuid);
51 } 53 }
52} 54}