aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/Groups/Service
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Addons/Groups/Service
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Addons/Groups/Service')
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs59
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsServiceBase.cs110
-rw-r--r--OpenSim/Addons/Groups/Service/HGGroupsService.cs2
3 files changed, 92 insertions, 79 deletions
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index 07641ef..ea0fedd 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Groups
126 126
127 #endregion 127 #endregion
128 128
129 public UUID CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 129 public UUID CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
130 bool allowPublish, bool maturePublish, UUID founderID, out string reason) 130 bool allowPublish, bool maturePublish, UUID founderID, out string reason)
131 { 131 {
132 reason = string.Empty; 132 reason = string.Empty;
@@ -264,7 +264,7 @@ namespace OpenSim.Groups
264 if (ownerRole != null) 264 if (ownerRole != null)
265 ownerRoleID = ownerRole.RoleID; 265 ownerRoleID = ownerRole.RoleID;
266 266
267 // Check visibility? 267 // Check visibility?
268 // When we don't want to check visibility, we pass it "all" as the requestingAgentID 268 // When we don't want to check visibility, we pass it "all" as the requestingAgentID
269 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString()); 269 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
270 270
@@ -307,20 +307,20 @@ namespace OpenSim.Groups
307 m.Contribution = Int32.Parse(d.Data["Contribution"]); 307 m.Contribution = Int32.Parse(d.Data["Contribution"]);
308 m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false; 308 m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
309 309
310 GridUserData gud = m_GridUserService.Get(d.PrincipalID); 310 GridUserData gud = m_GridUserService.Get(d.PrincipalID);
311 if (gud != null) 311 if (gud != null)
312 { 312 {
313 if (bool.Parse(gud.Data["Online"])) 313 if (bool.Parse(gud.Data["Online"]))
314 { 314 {
315 m.OnlineStatus = @"Online"; 315 m.OnlineStatus = @"Online";
316 } 316 }
317 else 317 else
318 { 318 {
319 int unixtime = int.Parse(gud.Data["Login"]); 319 int unixtime = int.Parse(gud.Data["Login"]);
320 // The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates! 320 // The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
321 m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy"); 321 m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
322 } 322 }
323 } 323 }
324 324
325 // Is this person an owner of the group? 325 // Is this person an owner of the group?
326 m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false; 326 m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
@@ -486,7 +486,7 @@ namespace OpenSim.Groups
486 // check permissions 486 // check permissions
487 bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited); 487 bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
488 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID); 488 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID);
489 if (!limited || !unlimited) 489 if (!limited && !unlimited)
490 { 490 {
491 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID); 491 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
492 return false; 492 return false;
@@ -496,7 +496,7 @@ namespace OpenSim.Groups
496 if (!unlimited && limited) 496 if (!unlimited && limited)
497 { 497 {
498 // check whether person's has this role 498 // check whether person's has this role
499 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 499 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
500 if (rolemembership == null) 500 if (rolemembership == null)
501 { 501 {
502 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID); 502 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
@@ -516,13 +516,26 @@ namespace OpenSim.Groups
516 return false; 516 return false;
517 517
518 // check permissions 518 // check permissions
519 bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
519 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID); 520 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
520 if (!unlimited) 521 if (!limited && !unlimited)
521 { 522 {
522 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID); 523 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
523 return false; 524 return false;
524 } 525 }
525 526
527 // AssignMemberLimited means that the person can assign another person to the same roles that she has in the group
528 if (!unlimited && limited)
529 {
530 // check whether person's has this role
531 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
532 if (rolemembership == null)
533 {
534 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
535 return false;
536 }
537 }
538
526 RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 539 RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
527 540
528 if (rolemember == null) 541 if (rolemember == null)
@@ -540,8 +553,8 @@ namespace OpenSim.Groups
540 { 553 {
541 newRoleID = r.RoleID; 554 newRoleID = r.RoleID;
542 break; 555 break;
543 } 556 }
544 } 557 }
545 558
546 MembershipData member = m_Database.RetrieveMember(GroupID, AgentID); 559 MembershipData member = m_Database.RetrieveMember(GroupID, AgentID);
547 if (member != null) 560 if (member != null)
@@ -699,7 +712,7 @@ namespace OpenSim.Groups
699 m_Database.StoreMember(membership); 712 m_Database.StoreMember(membership);
700 } 713 }
701 714
702 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, 715 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
703 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID) 716 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
704 { 717 {
705 // Check perms 718 // Check perms
@@ -812,7 +825,7 @@ namespace OpenSim.Groups
812 if (RoleID != UUID.Zero) 825 if (RoleID != UUID.Zero)
813 _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); 826 _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
814 827
815 // Make thit this active group 828 // Make this the active group
816 PrincipalData pdata = new PrincipalData(); 829 PrincipalData pdata = new PrincipalData();
817 pdata.PrincipalID = AgentID; 830 pdata.PrincipalID = AgentID;
818 pdata.ActiveGroupID = GroupID; 831 pdata.ActiveGroupID = GroupID;
diff --git a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
index 8e237aa..98d0172 100644
--- a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
@@ -35,67 +35,67 @@ using OpenSim.Services.Base;
35 35
36namespace OpenSim.Groups 36namespace OpenSim.Groups
37{ 37{
38 public class GroupsServiceBase : ServiceBase 38 public class GroupsServiceBase : ServiceBase
39 { 39 {
40 protected IGroupsData m_Database = null; 40 protected IGroupsData m_Database = null;
41 protected IGridUserData m_GridUserService = null; 41 protected IGridUserData m_GridUserService = null;
42 42
43 public GroupsServiceBase(IConfigSource config, string cName) 43 public GroupsServiceBase(IConfigSource config, string cName)
44 : base(config) 44 : base(config)
45 { 45 {
46 string dllName = String.Empty; 46 string dllName = String.Empty;
47 string connString = String.Empty; 47 string connString = String.Empty;
48 string realm = "os_groups"; 48 string realm = "os_groups";
49 string usersRealm = "GridUser"; 49 string usersRealm = "GridUser";
50 string configName = (cName == string.Empty) ? "Groups" : cName; 50 string configName = (cName == string.Empty) ? "Groups" : cName;
51 51
52 // 52 //
53 // Try reading the [DatabaseService] section, if it exists 53 // Try reading the [DatabaseService] section, if it exists
54 // 54 //
55 IConfig dbConfig = config.Configs["DatabaseService"]; 55 IConfig dbConfig = config.Configs["DatabaseService"];
56 if (dbConfig != null) 56 if (dbConfig != null)
57 { 57 {
58 if (dllName == String.Empty) 58 if (dllName == String.Empty)
59 dllName = dbConfig.GetString("StorageProvider", String.Empty); 59 dllName = dbConfig.GetString("StorageProvider", String.Empty);
60 if (connString == String.Empty) 60 if (connString == String.Empty)
61 connString = dbConfig.GetString("ConnectionString", String.Empty); 61 connString = dbConfig.GetString("ConnectionString", String.Empty);
62 } 62 }
63 63
64 // 64 //
65 // [Groups] section overrides [DatabaseService], if it exists 65 // [Groups] section overrides [DatabaseService], if it exists
66 // 66 //
67 IConfig groupsConfig = config.Configs[configName]; 67 IConfig groupsConfig = config.Configs[configName];
68 if (groupsConfig != null) 68 if (groupsConfig != null)
69 { 69 {
70 dllName = groupsConfig.GetString("StorageProvider", dllName); 70 dllName = groupsConfig.GetString("StorageProvider", dllName);
71 connString = groupsConfig.GetString("ConnectionString", connString); 71 connString = groupsConfig.GetString("ConnectionString", connString);
72 realm = groupsConfig.GetString("Realm", realm); 72 realm = groupsConfig.GetString("Realm", realm);
73 } 73 }
74 74
75 // 75 //
76 // We tried, but this doesn't exist. We can't proceed. 76 // We tried, but this doesn't exist. We can't proceed.
77 // 77 //
78 if (dllName.Equals(String.Empty)) 78 if (dllName.Equals(String.Empty))
79 throw new Exception("No StorageProvider configured"); 79 throw new Exception("No StorageProvider configured");
80 80
81 m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm }); 81 m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm });
82 if (m_Database == null) 82 if (m_Database == null)
83 throw new Exception("Could not find a storage interface in the given module " + dllName); 83 throw new Exception("Could not find a storage interface in the given module " + dllName);
84 84
85 // 85 //
86 // [GridUserService] section overrides [DatabaseService], if it exists 86 // [GridUserService] section overrides [DatabaseService], if it exists
87 // 87 //
88 IConfig usersConfig = config.Configs["GridUserService"]; 88 IConfig usersConfig = config.Configs["GridUserService"];
89 if (usersConfig != null) 89 if (usersConfig != null)
90 { 90 {
91 dllName = usersConfig.GetString("StorageProvider", dllName); 91 dllName = usersConfig.GetString("StorageProvider", dllName);
92 connString = usersConfig.GetString("ConnectionString", connString); 92 connString = usersConfig.GetString("ConnectionString", connString);
93 usersRealm = usersConfig.GetString("Realm", usersRealm); 93 usersRealm = usersConfig.GetString("Realm", usersRealm);
94 } 94 }
95 95
96 m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm }); 96 m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm });
97 if (m_GridUserService == null) 97 if (m_GridUserService == null)
98 throw new Exception("Could not find a storage inferface for the given users module " + dllName); 98 throw new Exception("Could not find a storage inferface for the given users module " + dllName);
99 } 99 }
100 } 100 }
101} 101}
diff --git a/OpenSim/Addons/Groups/Service/HGGroupsService.cs b/OpenSim/Addons/Groups/Service/HGGroupsService.cs
index 56e999b..7d86f85 100644
--- a/OpenSim/Addons/Groups/Service/HGGroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/HGGroupsService.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Groups
76 76
77 // Check if it already exists 77 // Check if it already exists
78 GroupData grec = m_Database.RetrieveGroup(groupID); 78 GroupData grec = m_Database.RetrieveGroup(groupID);
79 if (grec == null || 79 if (grec == null ||
80 (grec != null && grec.Data["Location"] != string.Empty && grec.Data["Location"].ToLower() != serviceLocation.ToLower())) 80 (grec != null && grec.Data["Location"] != string.Empty && grec.Data["Location"].ToLower() != serviceLocation.ToLower()))
81 { 81 {
82 // Create the group 82 // Create the group