PageRenderTime 53ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/Aurora/Services/DataService/Connectors/Local/LocalGroupsServiceConnector.cs

https://bitbucket.org/VirtualReality/aurora-sim
C# | 1830 lines | 1505 code | 274 blank | 51 comment | 344 complexity | 8eb1b0dcbfb001d3746d91163bc3e0d6 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * Copyright (c) Contributors, http://aurora-sim.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the Aurora-Sim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Linq;
  30. using System.Reflection;
  31. using Aurora.Framework;
  32. using Nini.Config;
  33. using OpenMetaverse;
  34. namespace Aurora.Services.DataService
  35. {
  36. public class LocalGroupsServiceConnector : ConnectorBase, IGroupsServiceConnector
  37. {
  38. #region Declares
  39. private IGenericData data;
  40. List<UUID> agentsCanBypassGroupNoticePermsCheck = new List<UUID>();
  41. #endregion
  42. #region IAuroraDataPlugin members
  43. public void Initialize(IGenericData GenericData, IConfigSource source, IRegistryCore simBase, string defaultConnectionString)
  44. {
  45. data = GenericData;
  46. if (source.Configs[Name] != null)
  47. {
  48. defaultConnectionString = source.Configs[Name].GetString("ConnectionString", defaultConnectionString);
  49. }
  50. if (source.Configs["Groups"] != null)
  51. {
  52. agentsCanBypassGroupNoticePermsCheck = Util.ConvertToList(source.Configs["Groups"].GetString("AgentsCanBypassGroupNoticePermsCheck", "")).ConvertAll(x => new UUID(x));
  53. }
  54. data.ConnectToDatabase(defaultConnectionString, "Groups",
  55. source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true));
  56. DataManager.DataManager.RegisterPlugin(Name + "Local", this);
  57. if (source.Configs["AuroraConnectors"].GetString("GroupsConnector", "LocalConnector") == "LocalConnector")
  58. {
  59. DataManager.DataManager.RegisterPlugin(this);
  60. }
  61. Init(simBase, Name);
  62. }
  63. public string Name
  64. {
  65. get { return "IGroupsServiceConnector"; }
  66. }
  67. #endregion
  68. #region IGroupsServiceConnector Members
  69. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  70. public void CreateGroup(UUID groupID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID, UUID OwnerRoleID)
  71. {
  72. object remoteValue = DoRemote(groupID, name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, founderID, OwnerRoleID);
  73. if (remoteValue != null || m_doRemoteOnly)
  74. return;
  75. // Would this be cleaner as (GroupPowers)ulong.MaxValue;
  76. ulong OwnerPowers = (ulong)(GroupPowers.Accountable
  77. | GroupPowers.AllowEditLand
  78. | GroupPowers.AllowFly
  79. | GroupPowers.AllowLandmark
  80. | GroupPowers.AllowRez
  81. | GroupPowers.AllowSetHome
  82. | GroupPowers.AllowVoiceChat
  83. | GroupPowers.AssignMember
  84. | GroupPowers.AssignMemberLimited
  85. | GroupPowers.ChangeActions
  86. | GroupPowers.ChangeIdentity
  87. | GroupPowers.ChangeMedia
  88. | GroupPowers.ChangeOptions
  89. | GroupPowers.CreateRole
  90. | GroupPowers.DeedObject
  91. | GroupPowers.DeleteRole
  92. | GroupPowers.Eject
  93. | GroupPowers.FindPlaces
  94. | GroupPowers.Invite
  95. | GroupPowers.JoinChat
  96. | GroupPowers.LandChangeIdentity
  97. | GroupPowers.LandDeed
  98. | GroupPowers.LandDivideJoin
  99. | GroupPowers.LandEdit
  100. | GroupPowers.LandEjectAndFreeze
  101. | GroupPowers.LandGardening
  102. | GroupPowers.LandManageAllowed
  103. | GroupPowers.LandManageBanned
  104. | GroupPowers.LandManagePasses
  105. | GroupPowers.LandOptions
  106. | GroupPowers.LandRelease
  107. | GroupPowers.LandSetSale
  108. | GroupPowers.ModerateChat
  109. | GroupPowers.ObjectManipulate
  110. | GroupPowers.ObjectSetForSale
  111. | GroupPowers.ReceiveNotices
  112. | GroupPowers.RemoveMember
  113. | GroupPowers.ReturnGroupOwned
  114. | GroupPowers.ReturnGroupSet
  115. | GroupPowers.ReturnNonGroup
  116. | GroupPowers.RoleProperties
  117. | GroupPowers.SendNotices
  118. | GroupPowers.SetLandingPoint
  119. | GroupPowers.StartProposal
  120. | GroupPowers.VoteOnProposal);
  121. ulong EveryonePowers = (ulong)(GroupPowers.AllowSetHome |
  122. GroupPowers.Accountable |
  123. GroupPowers.JoinChat |
  124. GroupPowers.AllowVoiceChat |
  125. GroupPowers.ReceiveNotices |
  126. GroupPowers.StartProposal |
  127. GroupPowers.VoteOnProposal);
  128. Dictionary<string, object> row = new Dictionary<string, object>(11);
  129. row["GroupID"] = groupID;
  130. row["Name"] = name;
  131. row["Charter"] = charter ?? "";
  132. row["InsigniaID"] = insigniaID;
  133. row["FounderID"] = founderID;
  134. row["MembershipFee"] = membershipFee;
  135. row["OpenEnrollment"] = openEnrollment ? 1 : 0;
  136. row["ShowInList"] = showInList ? 1 : 0;
  137. row["AllowPublish"] = allowPublish ? 1 : 0;
  138. row["MaturePublish"] = maturePublish ? 1 : 0;
  139. row["OwnerRoleID"] = OwnerRoleID;
  140. data.Insert("osgroup", row);
  141. //Add everyone role to group
  142. AddRoleToGroup(founderID, groupID, UUID.Zero, "Everyone", "Everyone in the group is in the everyone role.", "Member of " + name, EveryonePowers);
  143. const ulong groupPowers = 296868139497678;
  144. UUID officersRole = UUID.Random();
  145. //Add officers role to group
  146. AddRoleToGroup(founderID, groupID, officersRole, "Officers", "The officers of the group, with more powers than regular members.", "Officer of " + name, groupPowers);
  147. //Add owner role to group
  148. AddRoleToGroup(founderID, groupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, OwnerPowers);
  149. //Add owner to the group as owner
  150. AddAgentToGroup(founderID, founderID, groupID, OwnerRoleID);
  151. AddAgentToRole(founderID, founderID, groupID, officersRole);
  152. SetAgentGroupSelectedRole(founderID, groupID, OwnerRoleID);
  153. SetAgentActiveGroup(founderID, groupID);
  154. }
  155. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Full)]
  156. public void UpdateGroupFounder(UUID groupID, UUID newOwner, bool keepOldOwnerInGroup)
  157. {
  158. object remoteValue = DoRemote(groupID, newOwner, keepOldOwnerInGroup);
  159. if (remoteValue != null || m_doRemoteOnly)
  160. return;
  161. GroupRecord record = GetGroupRecord(UUID.Zero, groupID, "");
  162. bool newUserExists = GetAgentGroupMemberData(newOwner, groupID, newOwner) != null;
  163. Dictionary<string, object> values = new Dictionary<string, object>(1);
  164. values["FounderID"] = newOwner;
  165. QueryFilter filter = new QueryFilter();
  166. filter.andFilters["GroupID"] = groupID;
  167. data.Update("osgroup", values, null, filter, null, null);
  168. if (!newUserExists)
  169. AddAgentToGroup(newOwner, newOwner, groupID, record.OwnerRoleID);
  170. else
  171. AddAgentToRole(newOwner, newOwner, groupID, record.OwnerRoleID);
  172. if (!keepOldOwnerInGroup)
  173. RemoveAgentFromGroup(newOwner, record.FounderID, groupID);
  174. }
  175. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  176. public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, int showInList, UUID insigniaID, int membershipFee, int openEnrollment, int allowPublish, int maturePublish)
  177. {
  178. object remoteValue = DoRemote(requestingAgentID, groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish);
  179. if (remoteValue != null || m_doRemoteOnly)
  180. return;
  181. if (CheckGroupPermissions(requestingAgentID, groupID, (ulong)(GroupPowers.ChangeOptions | GroupPowers.ChangeIdentity)))
  182. {
  183. Dictionary<string, object> values = new Dictionary<string, object>(6);
  184. values["Charter"] = charter;
  185. values["InsigniaID"] = insigniaID;
  186. values["MembershipFee"] = membershipFee;
  187. values["OpenEnrollment"] = openEnrollment;
  188. values["ShowInList"] = showInList;
  189. values["AllowPublish"] = allowPublish;
  190. values["MaturePublish"] = maturePublish;
  191. QueryFilter filter = new QueryFilter();
  192. filter.andFilters["GroupID"] = groupID;
  193. data.Update("osgroup", values, null, filter, null, null);
  194. }
  195. }
  196. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  197. public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, UUID ItemID, int AssetType, string ItemName)
  198. {
  199. object remoteValue = DoRemote(requestingAgentID, groupID, noticeID, fromName, subject, message, ItemID, AssetType, ItemName);
  200. if (remoteValue != null || m_doRemoteOnly)
  201. return;
  202. if (CheckGroupPermissions(requestingAgentID, groupID, (ulong)GroupPowers.SendNotices))
  203. {
  204. Dictionary<string, object> row = new Dictionary<string, object>(10);
  205. row["GroupID"] = groupID;
  206. row["NoticeID"] = noticeID == UUID.Zero ? UUID.Random() : noticeID;
  207. row["Timestamp"] = ((uint) Util.UnixTimeSinceEpoch());
  208. row["FromName"] = fromName;
  209. row["Subject"] = subject;
  210. row["Message"] = message;
  211. row["HasAttachment"] = (ItemID != UUID.Zero) ? 1 : 0;
  212. row["ItemID"] = ItemID;
  213. row["AssetType"] = AssetType;
  214. row["ItemName"] = ItemName == null ? "" : ItemName;
  215. data.Insert("osgroupnotice", row);
  216. }
  217. }
  218. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.High)]
  219. public bool EditGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string subject, string message)
  220. {
  221. object remoteValue = DoRemote(requestingAgentID, groupID, noticeID, subject, message);
  222. if (remoteValue != null || m_doRemoteOnly)
  223. {
  224. return (bool)remoteValue;
  225. }
  226. if(!agentsCanBypassGroupNoticePermsCheck.Contains(requestingAgentID) && !CheckGroupPermissions(requestingAgentID, groupID, (ulong)GroupPowers.SendNotices)){
  227. MainConsole.Instance.TraceFormat("Permission check failed when trying to edit group notice {0}.", noticeID);
  228. return false;
  229. }
  230. GroupNoticeInfo GNI = GetGroupNotice(requestingAgentID, noticeID);
  231. if (GNI == null)
  232. {
  233. MainConsole.Instance.TraceFormat("Could not find group notice {0}", noticeID);
  234. return false;
  235. }
  236. else if (GNI.GroupID != groupID)
  237. {
  238. MainConsole.Instance.TraceFormat("Group notice {0} group ID {1} does not match supplied group ID {2}", noticeID, GNI.GroupID, groupID);
  239. return false;
  240. }
  241. else if(subject.Trim() == string.Empty || message.Trim() == string.Empty)
  242. {
  243. MainConsole.Instance.TraceFormat("Could not edit group notice {0}, message or subject was empty", noticeID);
  244. return false;
  245. }
  246. QueryFilter filter = new QueryFilter();
  247. filter.andFilters["GroupID"] = groupID;
  248. filter.andFilters["NoticeID"] = noticeID;
  249. Dictionary<string, object> update = new Dictionary<string,object>(2);
  250. update["Subject"] = subject.Trim();
  251. update["Message"] = message.Trim();
  252. return data.Update("osgroupnotice", update, null, filter, null, null);
  253. }
  254. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.High)]
  255. public bool RemoveGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID)
  256. {
  257. object remoteValue = DoRemote(requestingAgentID, groupID, noticeID);
  258. if (remoteValue != null || m_doRemoteOnly)
  259. {
  260. return (bool)remoteValue;
  261. }
  262. if (!agentsCanBypassGroupNoticePermsCheck.Contains(requestingAgentID) && !CheckGroupPermissions(requestingAgentID, groupID, (ulong)GroupPowers.SendNotices))
  263. {
  264. MainConsole.Instance.TraceFormat("Permission check failed when trying to edit group notice {0}.", noticeID);
  265. return false;
  266. }
  267. GroupNoticeInfo GNI = GetGroupNotice(requestingAgentID, noticeID);
  268. if (GNI == null)
  269. {
  270. MainConsole.Instance.TraceFormat("Could not find group notice {0}", noticeID);
  271. return false;
  272. }
  273. else if (GNI.GroupID != groupID)
  274. {
  275. MainConsole.Instance.TraceFormat("Group notice {0} group ID {1} does not match supplied group ID {2}", noticeID, GNI.GroupID, groupID);
  276. return false;
  277. }
  278. QueryFilter filter = new QueryFilter();
  279. filter.andFilters["GroupID"] = groupID;
  280. filter.andFilters["NoticeID"] = noticeID;
  281. return data.Delete("osgroupnotice", filter);
  282. }
  283. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  284. public string SetAgentActiveGroup(UUID AgentID, UUID GroupID)
  285. {
  286. object remoteValue = DoRemote(AgentID, GroupID);
  287. if (remoteValue != null || m_doRemoteOnly)
  288. return (string)remoteValue;
  289. QueryFilter filter = new QueryFilter();
  290. filter.andFilters["AgentID"] = AgentID;
  291. if (data.Query(new[] { "*" }, "osagent", filter, null, null, null).Count != 0)
  292. {
  293. Dictionary<string, object> values = new Dictionary<string, object>(1);
  294. values["ActiveGroupID"] = GroupID;
  295. data.Update("osagent", values, null, filter, null, null);
  296. }
  297. else
  298. {
  299. Dictionary<string, object> row = new Dictionary<string, object>(2);
  300. row["AgentID"] = AgentID;
  301. row["ActiveGroupID"] = GroupID;
  302. data.Insert("osagent", row);
  303. }
  304. GroupMembersData gdata = GetAgentGroupMemberData(AgentID, GroupID, AgentID);
  305. return gdata == null ? "" : gdata.Title;
  306. }
  307. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  308. public UUID GetAgentActiveGroup(UUID RequestingAgentID, UUID AgentID)
  309. {
  310. object remoteValue = DoRemote(RequestingAgentID, AgentID);
  311. if (remoteValue != null || m_doRemoteOnly)
  312. return (UUID)remoteValue; // note: this is bad, you can't cast a null object to a UUID
  313. QueryFilter filter = new QueryFilter();
  314. filter.andFilters["AgentID"] = AgentID;
  315. List<string> groups = data.Query(new string[1] { "ActiveGroupID" }, "osagent", filter, null, null, null);
  316. return (groups.Count != 0) ? UUID.Parse(groups[0]) : UUID.Zero;
  317. }
  318. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  319. public string SetAgentGroupSelectedRole(UUID AgentID, UUID GroupID, UUID RoleID)
  320. {
  321. object remoteValue = DoRemote(AgentID, GroupID, RoleID);
  322. if (remoteValue != null || m_doRemoteOnly)
  323. return (string)remoteValue;
  324. Dictionary<string, object> values = new Dictionary<string, object>(1);
  325. values["SelectedRoleID"] = RoleID;
  326. QueryFilter filter = new QueryFilter();
  327. filter.andFilters["AgentID"] = AgentID;
  328. filter.andFilters["GroupID"] = GroupID;
  329. data.Update("osgroupmembership", values, null, filter, null, null);
  330. GroupMembersData gdata = GetAgentGroupMemberData(AgentID, GroupID, AgentID);
  331. return gdata == null ? "" : gdata.Title;
  332. }
  333. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  334. public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  335. {
  336. object remoteValue = DoRemote(requestingAgentID, AgentID, GroupID, RoleID);
  337. if (remoteValue != null || m_doRemoteOnly)
  338. return;
  339. Dictionary<string, object> where = new Dictionary<string, object>(2);
  340. where["AgentID"] = AgentID;
  341. where["GroupID"] = GroupID;
  342. if (data.Query(new[] { "*" }, "osgroupmembership", new QueryFilter
  343. {
  344. andFilters = where
  345. }, null, null, null).Count != 0)
  346. {
  347. MainConsole.Instance.Error("[AGM]: Agent " + AgentID + " is already in " + GroupID);
  348. return;
  349. }
  350. Dictionary<string, object> row = new Dictionary<string, object>(6);
  351. row["GroupID"] = GroupID;
  352. row["AgentID"] = AgentID;
  353. row["SelectedRoleID"] = RoleID;
  354. row["Contribution"] = 0;
  355. row["ListInProfile"] = 1;
  356. row["AcceptNotices"] = 1;
  357. data.Insert("osgroupmembership", row);
  358. // Make sure they're in the Everyone role
  359. AddAgentToRole(requestingAgentID, AgentID, GroupID, UUID.Zero);
  360. // Make sure they're in specified role, if they were invited
  361. if (RoleID != UUID.Zero)
  362. AddAgentToRole(requestingAgentID, AgentID, GroupID, RoleID);
  363. //Set the role they were invited to as their selected role
  364. SetAgentGroupSelectedRole(AgentID, GroupID, RoleID);
  365. SetAgentActiveGroup(AgentID, GroupID);
  366. }
  367. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  368. public bool RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  369. {
  370. //Allow kicking yourself
  371. object remoteValue = DoRemote(requestingAgentID, AgentID, GroupID);
  372. if (remoteValue != null || m_doRemoteOnly)
  373. return remoteValue != null && (bool)remoteValue;
  374. if ((CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.RemoveMember)) || (requestingAgentID == AgentID))
  375. {
  376. QueryFilter filter = new QueryFilter();
  377. filter.andFilters["AgentID"] = AgentID;
  378. filter.andFilters["ActiveGroupID"] = GroupID;
  379. Dictionary<string, object> values = new Dictionary<string, object>(1);
  380. values["ActiveGroupID"] = UUID.Zero;
  381. // 1. If group is agent's active group, change active group to uuidZero
  382. data.Update("osagent", values, null, filter, null, null);
  383. filter.andFilters.Remove("ActiveGroupID");
  384. filter.andFilters["GroupID"] = GroupID;
  385. // 2. Remove Agent from group (osgroupmembership)
  386. data.Delete("osgrouprolemembership", filter);
  387. // 3. Remove Agent from all of the groups roles (osgrouprolemembership)
  388. data.Delete("osgroupmembership", filter);
  389. return true;
  390. }
  391. return false;
  392. }
  393. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  394. public void AddRoleToGroup(UUID requestingAgentID, UUID GroupID, UUID RoleID, string NameOf, string Description, string Title, ulong Powers)
  395. {
  396. object remoteValue = DoRemote(requestingAgentID, GroupID, RoleID, NameOf, Description, Title, Powers);
  397. if (remoteValue != null || m_doRemoteOnly)
  398. return;
  399. if (CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.CreateRole))
  400. {
  401. Dictionary<string, object> row = new Dictionary<string, object>(6);
  402. row["GroupID"] = GroupID;
  403. row["RoleID"] = RoleID;
  404. row["Name"] = NameOf;
  405. row["Description"] = Description;
  406. row["Title"] = Title;
  407. row["Powers"] = (long)Powers;
  408. data.Insert("osrole", row);
  409. }
  410. }
  411. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  412. public void UpdateRole(UUID requestingAgentID, UUID GroupID, UUID RoleID, string NameOf, string Desc, string Title, ulong Powers)
  413. {
  414. object remoteValue = DoRemote(requestingAgentID, GroupID, RoleID, NameOf, Desc, Title, Powers);
  415. if (remoteValue != null || m_doRemoteOnly)
  416. return;
  417. if (CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.RoleProperties))
  418. {
  419. Dictionary<string, object> values = new Dictionary<string, object>();
  420. values["RoleID"] = RoleID;
  421. if (NameOf != null)
  422. {
  423. values["Name"] = NameOf;
  424. }
  425. if (Desc != null)
  426. {
  427. values["Description"] = Desc;
  428. }
  429. if (Title != null)
  430. {
  431. values["Title"] = Title;
  432. }
  433. values["Powers"] = Powers.ToString();
  434. QueryFilter filter = new QueryFilter();
  435. filter.andFilters["GroupID"] = GroupID;
  436. filter.andFilters["RoleID"] = RoleID;
  437. data.Update("osrole", values, null, filter, null, null);
  438. }
  439. }
  440. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  441. public void RemoveRoleFromGroup(UUID requestingAgentID, UUID RoleID, UUID GroupID)
  442. {
  443. object remoteValue = DoRemote(requestingAgentID, RoleID, GroupID);
  444. if (remoteValue != null || m_doRemoteOnly)
  445. return;
  446. if (CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.DeleteRole))
  447. {
  448. Dictionary<string, object> values = new Dictionary<string, object>(1);
  449. values["SelectedRoleID"] = UUID.Zero;
  450. QueryFilter ufilter = new QueryFilter();
  451. ufilter.andFilters["GroupID"] = GroupID;
  452. ufilter.andFilters["SelectedRoleID"] = RoleID;
  453. QueryFilter dfilter = new QueryFilter();
  454. dfilter.andFilters["GroupID"] = GroupID;
  455. dfilter.andFilters["RoleID"] = RoleID;
  456. data.Delete("osgrouprolemembership", dfilter);
  457. data.Update("osgroupmembership", values, null, ufilter, null, null);
  458. data.Delete("osrole", dfilter);
  459. }
  460. }
  461. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  462. public void AddAgentToRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  463. {
  464. object remoteValue = DoRemote(requestingAgentID, AgentID, GroupID, RoleID);
  465. if (remoteValue != null || m_doRemoteOnly)
  466. return;
  467. if (!CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.AssignMember))
  468. {
  469. //This isn't an open and shut case, they could be setting the agent to their role, which would allow for AssignMemberLimited
  470. if (!CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.AssignMemberLimited))
  471. {
  472. GroupProfileData profile = GetGroupProfile(requestingAgentID, GroupID);
  473. if (profile == null || !profile.OpenEnrollment || RoleID != UUID.Zero)//For open enrollment adding
  474. {
  475. MainConsole.Instance.Warn("[AGM]: User " + requestingAgentID + " attempted to add user " + AgentID +
  476. " to group " + GroupID + ", but did not have permissions to do so!");
  477. return;
  478. }
  479. }
  480. }
  481. QueryFilter filter = new QueryFilter();
  482. filter.andFilters["GroupID"] = GroupID;
  483. filter.andFilters["RoleID"] = RoleID;
  484. filter.andFilters["AgentID"] = AgentID;
  485. //Make sure they arn't already in this role
  486. if (uint.Parse(data.Query(new[] { "COUNT(AgentID)" }, "osgrouprolemembership", filter, null, null, null)[0]) == 0)
  487. {
  488. Dictionary<string, object> row = new Dictionary<string, object>(3);
  489. row["GroupID"] = GroupID;
  490. row["RoleID"] = RoleID;
  491. row["AgentID"] = AgentID;
  492. data.Insert("osgrouprolemembership", row);
  493. }
  494. }
  495. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  496. public void RemoveAgentFromRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  497. {
  498. object remoteValue = DoRemote(requestingAgentID, AgentID, GroupID, RoleID);
  499. if (remoteValue != null || m_doRemoteOnly)
  500. return;
  501. if (CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.AssignMember))
  502. {
  503. Dictionary<string, object> values = new Dictionary<string, object>(1);
  504. values["SelectedRoleID"] = UUID.Zero;
  505. QueryFilter filter = new QueryFilter();
  506. filter.andFilters["AgentID"] = AgentID;
  507. filter.andFilters["GroupID"] = GroupID;
  508. filter.andFilters["SelectedRoleID"] = RoleID;
  509. data.Update("osgroupmembership", values, null, filter, null, null);
  510. filter.andFilters.Remove("SelectedRoleID");
  511. filter.andFilters["RoleID"] = RoleID;
  512. data.Delete("osgrouprolemembership", filter);
  513. }
  514. }
  515. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  516. public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, int AcceptNotices, int ListInProfile)
  517. {
  518. object remoteValue = DoRemote(requestingAgentID, AgentID, GroupID, AcceptNotices, ListInProfile);
  519. if (remoteValue != null || m_doRemoteOnly)
  520. return;
  521. if (!CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.ChangeIdentity))
  522. {
  523. return;
  524. }
  525. Dictionary<string, object> values = new Dictionary<string, object>(3);
  526. values["AgentID"] = AgentID;
  527. values["AcceptNotices"] = AcceptNotices;
  528. values["ListInProfile"] = ListInProfile;
  529. QueryFilter filter = new QueryFilter();
  530. // these look the wrong way around ~ SignpostMarv
  531. filter.andFilters["GroupID"] = AgentID;
  532. filter.andFilters["AgentID"] = GroupID;
  533. data.Update("osgroupmembership", values, null, filter, null, null);
  534. }
  535. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  536. public void AddAgentGroupInvite(UUID requestingAgentID, UUID inviteID, UUID GroupID, UUID roleID, UUID AgentID, string FromAgentName)
  537. {
  538. object remoteValue = DoRemote(requestingAgentID, inviteID, GroupID, roleID, AgentID, FromAgentName);
  539. if (remoteValue != null || m_doRemoteOnly)
  540. return;
  541. if (CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.Invite))
  542. {
  543. QueryFilter filter = new QueryFilter();
  544. filter.andFilters["AgentID"] = AgentID;
  545. filter.andFilters["GroupID"] = GroupID;
  546. data.Delete("osgroupinvite", filter);
  547. Dictionary<string, object> row = new Dictionary<string, object>(6);
  548. row["InviteID"] = inviteID;
  549. row["GroupID"] = GroupID;
  550. row["RoleID"] = roleID;
  551. row["AgentID"] = AgentID;
  552. row["TMStamp"] = Util.UnixTimeSinceEpoch();
  553. row["FromAgentName"] = FromAgentName;
  554. data.Insert("osgroupinvite", row);
  555. }
  556. }
  557. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  558. public void RemoveAgentInvite(UUID requestingAgentID, UUID inviteID)
  559. {
  560. object remoteValue = DoRemote(requestingAgentID, inviteID);
  561. if (remoteValue != null || m_doRemoteOnly)
  562. return;
  563. QueryFilter filter = new QueryFilter();
  564. filter.andFilters["InviteID"] = inviteID;
  565. data.Delete("osgroupinvite", filter);
  566. }
  567. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  568. public void AddGroupProposal(UUID agentID, GroupProposalInfo info)
  569. {
  570. object remoteValue = DoRemote(agentID, info);
  571. if (remoteValue != null || m_doRemoteOnly)
  572. return;
  573. if (CheckGroupPermissions(agentID, info.GroupID, (ulong)GroupPowers.StartProposal))
  574. GenericUtils.AddGeneric(info.GroupID, "Proposal", info.VoteID.ToString(), info.ToOSD(), data);
  575. }
  576. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  577. public List<GroupProposalInfo> GetActiveProposals(UUID agentID, UUID groupID)
  578. {
  579. object remoteValue = DoRemote(agentID, groupID);
  580. if (remoteValue != null || m_doRemoteOnly)
  581. return (List<GroupProposalInfo>)remoteValue;
  582. if (!CheckGroupPermissions(agentID, groupID, (ulong)GroupPowers.VoteOnProposal))
  583. return new List<GroupProposalInfo>();
  584. List<GroupProposalInfo> proposals = GenericUtils.GetGenerics<GroupProposalInfo>(groupID, "Proposal", data);
  585. proposals = (from p in proposals where p.Ending > DateTime.Now select p).ToList();
  586. foreach (GroupProposalInfo p in proposals)
  587. p.VoteCast = GetHasVoted(agentID, p);
  588. return proposals;//Return only ones that are still running
  589. }
  590. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  591. public List<GroupProposalInfo> GetInactiveProposals(UUID agentID, UUID groupID)
  592. {
  593. object remoteValue = DoRemote(agentID, groupID);
  594. if (remoteValue != null || m_doRemoteOnly)
  595. return (List<GroupProposalInfo>)remoteValue;
  596. if (!CheckGroupPermissions(agentID, groupID, (ulong)GroupPowers.VoteOnProposal))
  597. return new List<GroupProposalInfo>();
  598. List<GroupProposalInfo> proposals = GenericUtils.GetGenerics<GroupProposalInfo>(groupID, "Proposal", data);
  599. proposals = (from p in proposals where p.Ending < DateTime.Now select p).ToList();
  600. List<GroupProposalInfo> proposalsNeedingResults = (from p in proposals where !p.HasCalculatedResult select p).ToList();
  601. foreach (GroupProposalInfo p in proposalsNeedingResults)
  602. {
  603. List<OpenMetaverse.StructuredData.OSDMap> maps = GenericUtils.GetGenerics(p.GroupID, p.VoteID.ToString(), data);
  604. int yes = 0;
  605. int no = 0;
  606. foreach (OpenMetaverse.StructuredData.OSDMap vote in maps)
  607. {
  608. if (vote["Vote"].AsString().ToLower() == "yes")
  609. yes++;
  610. else if (vote["Vote"].AsString().ToLower() == "no")
  611. no++;
  612. }
  613. if (yes + no < p.Quorum)
  614. p.Result = false;
  615. /*if (yes > no)
  616. p.Result = true;
  617. else
  618. p.Result = false;*/
  619. p.HasCalculatedResult = true;
  620. GenericUtils.AddGeneric(p.GroupID, "Proposal", p.VoteID.ToString(), p.ToOSD(), data);
  621. }
  622. foreach (GroupProposalInfo p in proposals)
  623. p.VoteCast = GetHasVoted(agentID, p);
  624. return proposals;//Return only ones that are still running
  625. }
  626. private string GetHasVoted(UUID agentID, GroupProposalInfo p)
  627. {
  628. OpenMetaverse.StructuredData.OSDMap map = GenericUtils.GetGeneric(p.GroupID, p.VoteID.ToString(), agentID.ToString(), data);
  629. if (map != null)
  630. return map["Vote"];
  631. return "";
  632. }
  633. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  634. public void VoteOnActiveProposals(UUID agentID, UUID groupID, UUID proposalID, string vote)
  635. {
  636. object remoteValue = DoRemote(agentID, groupID, proposalID, vote);
  637. if (remoteValue != null || m_doRemoteOnly)
  638. return;
  639. if (!CheckGroupPermissions(agentID, groupID, (ulong)GroupPowers.VoteOnProposal))
  640. return;
  641. OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap();
  642. map["Vote"] = vote;
  643. GenericUtils.AddGeneric(groupID, proposalID.ToString(), agentID.ToString(), map, data);
  644. }
  645. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  646. public uint GetNumberOfGroupNotices(UUID requestingAgentID, UUID GroupID)
  647. {
  648. object remoteValue = DoRemote(requestingAgentID, GroupID);
  649. if (remoteValue != null || m_doRemoteOnly)
  650. return (uint)remoteValue; // note: this is bad, you can't cast a null object to a uint
  651. List<UUID> GroupIDs = new List<UUID> { GroupID };
  652. return GetNumberOfGroupNotices(requestingAgentID, GroupIDs);
  653. }
  654. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  655. public uint GetNumberOfGroupNotices(UUID requestingAgentID, List<UUID> GroupIDs)
  656. {
  657. object remoteValue = DoRemote(requestingAgentID, GroupIDs);
  658. if (remoteValue != null || m_doRemoteOnly)
  659. return (uint)remoteValue; // note: this is bad, you can't cast a null object to a uint
  660. bool had = GroupIDs.Count > 0;
  661. List<UUID> groupIDs = new List<UUID>();
  662. if (!agentsCanBypassGroupNoticePermsCheck.Contains(requestingAgentID))
  663. {
  664. #if (!ISWIN)
  665. foreach (UUID GroupID in GroupIDs)
  666. {
  667. if (CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.ReceiveNotices))
  668. groupIDs.Add(GroupID);
  669. }
  670. #else
  671. groupIDs.AddRange(GroupIDs.Where(GroupID => CheckGroupPermissions(requestingAgentID, GroupID, (ulong) GroupPowers.ReceiveNotices)));
  672. #endif
  673. }
  674. else
  675. {
  676. groupIDs = GroupIDs;
  677. }
  678. if (had && groupIDs.Count == 0)
  679. {
  680. return 0;
  681. }
  682. QueryFilter filter = new QueryFilter();
  683. List<object> filterGroupIDs = new List<object>(groupIDs.Count);
  684. filterGroupIDs.AddRange(groupIDs.Cast<object>());
  685. if (filterGroupIDs.Count > 0)
  686. {
  687. filter.orMultiFilters["GroupID"] = filterGroupIDs;
  688. }
  689. return uint.Parse(data.Query(new[] { "COUNT(NoticeID)" }, "osgroupnotice", filter, null, null, null)[0]);
  690. }
  691. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  692. public uint GetNumberOfGroups(UUID requestingAgentID, Dictionary<string, bool> boolFields)
  693. {
  694. object remoteValue = DoRemote(requestingAgentID, boolFields);
  695. if (remoteValue != null || m_doRemoteOnly)
  696. return (uint)remoteValue; // note: this is bad, you can't cast a null object to a uint
  697. QueryFilter filter = new QueryFilter();
  698. string[] BoolFields = { "OpenEnrollment", "ShowInList", "AllowPublish", "MaturePublish" };
  699. foreach (string field in BoolFields)
  700. {
  701. if (boolFields.ContainsKey(field))
  702. {
  703. filter.andFilters[field] = boolFields[field] ? "1" : "0";
  704. }
  705. }
  706. return uint.Parse(data.Query(new[] { "COUNT(GroupID)" }, "osgroup", filter, null, null, null)[0]);
  707. }
  708. private static GroupRecord GroupRecordQueryResult2GroupRecord(List<String> result)
  709. {
  710. return new GroupRecord
  711. {
  712. GroupID = UUID.Parse(result[0]),
  713. GroupName = result[1],
  714. Charter = result[2],
  715. GroupPicture = UUID.Parse(result[3]),
  716. FounderID = UUID.Parse(result[4]),
  717. MembershipFee = int.Parse(result[5]),
  718. OpenEnrollment = int.Parse(result[6]) == 1,
  719. ShowInList = int.Parse(result[7]) == 1,
  720. AllowPublish = int.Parse(result[8]) == 1,
  721. MaturePublish = int.Parse(result[9]) == 1,
  722. OwnerRoleID = UUID.Parse(result[10])
  723. };
  724. }
  725. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  726. public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName)
  727. {
  728. object remoteValue = DoRemote(requestingAgentID, GroupID, GroupName);
  729. if (remoteValue != null || m_doRemoteOnly)
  730. return (GroupRecord)remoteValue;
  731. QueryFilter filter = new QueryFilter();
  732. if (GroupID != UUID.Zero)
  733. {
  734. filter.andFilters["GroupID"] = GroupID;
  735. }
  736. if (!string.IsNullOrEmpty(GroupName))
  737. {
  738. filter.andFilters["Name"] = GroupName;
  739. }
  740. if (filter.Count == 0)
  741. {
  742. return null;
  743. }
  744. List<string> osgroupsData = data.Query(new[]{
  745. "GroupID",
  746. "Name",
  747. "Charter",
  748. "InsigniaID",
  749. "FounderID",
  750. "MembershipFee",
  751. "OpenEnrollment",
  752. "ShowInList",
  753. "AllowPublish",
  754. "MaturePublish",
  755. "OwnerRoleID"
  756. }, "osgroup", filter, null, null, null);
  757. return (osgroupsData.Count == 0) ? null : GroupRecordQueryResult2GroupRecord(osgroupsData);
  758. }
  759. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  760. public List<GroupRecord> GetGroupRecords(UUID requestingAgentID, uint start, uint count, Dictionary<string, bool> sort, Dictionary<string, bool> boolFields)
  761. {
  762. // List<string> filter = new List<string>();
  763. object remoteValue = DoRemote(requestingAgentID, start, count, boolFields);
  764. if (remoteValue != null || m_doRemoteOnly)
  765. return (List<GroupRecord>)remoteValue;
  766. string[] sortAndBool = { "OpenEnrollment", "MaturePublish" };
  767. string[] BoolFields = { "OpenEnrollment", "ShowInList", "AllowPublish", "MaturePublish" };
  768. foreach (string field in sortAndBool)
  769. {
  770. if (boolFields.ContainsKey(field) && sort.ContainsKey(field))
  771. {
  772. sort.Remove(field);
  773. }
  774. }
  775. QueryFilter filter = new QueryFilter();
  776. foreach (string field in BoolFields)
  777. {
  778. if (boolFields.ContainsKey(field))
  779. {
  780. filter.andFilters[field] = boolFields[field] ? "1" : "0";
  781. }
  782. }
  783. List<GroupRecord> Reply = new List<GroupRecord>();
  784. List<string> osgroupsData = data.Query(new[]{
  785. "GroupID",
  786. "Name",
  787. "Charter",
  788. "InsigniaID",
  789. "FounderID",
  790. "MembershipFee",
  791. "OpenEnrollment",
  792. "ShowInList",
  793. "AllowPublish",
  794. "MaturePublish",
  795. "OwnerRoleID"
  796. }, "osgroup", filter, sort, start, count);
  797. if (osgroupsData.Count < 11)
  798. {
  799. return Reply;
  800. }
  801. for (int i = 0; i < osgroupsData.Count; i += 11)
  802. {
  803. Reply.Add(GroupRecordQueryResult2GroupRecord(osgroupsData.GetRange(i, 11)));
  804. }
  805. return Reply;
  806. }
  807. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  808. public List<GroupRecord> GetGroupRecords(UUID requestingAgentID, List<UUID> GroupIDs)
  809. {
  810. object remoteValue = DoRemote(requestingAgentID, GroupIDs);
  811. if (remoteValue != null || m_doRemoteOnly)
  812. return (List<GroupRecord>)remoteValue;
  813. List<GroupRecord> Reply = new List<GroupRecord>(0);
  814. if (GroupIDs.Count <= 0)
  815. {
  816. return Reply;
  817. }
  818. QueryFilter filter = new QueryFilter();
  819. filter.orMultiFilters["GroupID"] = new List<object>();
  820. foreach (UUID groupID in GroupIDs)
  821. {
  822. filter.orMultiFilters["GroupID"].Add(groupID);
  823. }
  824. List<string> osgroupsData = data.Query(new[]{
  825. "GroupID",
  826. "Name",
  827. "Charter",
  828. "InsigniaID",
  829. "FounderID",
  830. "MembershipFee",
  831. "OpenEnrollment",
  832. "ShowInList",
  833. "AllowPublish",
  834. "MaturePublish",
  835. "OwnerRoleID"
  836. }, "osgroup", filter, null, null, null);
  837. if (osgroupsData.Count < 11)
  838. {
  839. return Reply;
  840. }
  841. for (int i = 0; i < osgroupsData.Count; i += 11)
  842. {
  843. Reply.Add(GroupRecordQueryResult2GroupRecord(osgroupsData.GetRange(i, 11)));
  844. }
  845. return Reply;
  846. }
  847. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  848. public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
  849. {
  850. object remoteValue = DoRemote(requestingAgentID, GroupID, AgentID);
  851. if (remoteValue != null || m_doRemoteOnly)
  852. return (GroupProfileData)remoteValue;
  853. if (!CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.MemberVisible))
  854. return new GroupProfileData();
  855. GroupProfileData GPD = new GroupProfileData();
  856. GroupRecord record = GetGroupRecord(requestingAgentID, GroupID, null);
  857. QueryFilter filter1 = new QueryFilter();
  858. filter1.andFilters["GroupID"] = AgentID; // yes these look the wrong way around
  859. filter1.andFilters["AgentID"] = GroupID; // but they were like that when I got here! ~ SignpostMarv
  860. QueryFilter filter2 = new QueryFilter();
  861. filter2.andFilters["GroupID"] = GroupID;
  862. List<string> Membership = data.Query(new[]{
  863. "Contribution",
  864. "ListInProfile",
  865. "SelectedRoleID"
  866. }, "osgroupmembership", filter1, null, null, null);
  867. int GroupMemCount = int.Parse(data.Query(new[] { "COUNT(AgentID)" }, "osgroupmembership", filter2, null, null, null)[0]);
  868. int GroupRoleCount = int.Parse(data.Query(new[] { "COUNT(RoleID)" }, "osrole", filter2, null, null, null)[0]);
  869. QueryFilter filter3 = new QueryFilter();
  870. filter3.andFilters["RoleID"] = Membership[2];
  871. List<string> GroupRole = data.Query(new[] {
  872. "Name",
  873. "Powers"
  874. }, "osrole", filter3, null, null, null);
  875. GPD.AllowPublish = record.AllowPublish;
  876. GPD.Charter = record.Charter;
  877. GPD.FounderID = record.FounderID;
  878. GPD.GroupID = record.GroupID;
  879. GPD.GroupMembershipCount = GroupMemCount;
  880. GPD.GroupRolesCount = GroupRoleCount;
  881. GPD.InsigniaID = record.GroupPicture;
  882. GPD.MaturePublish = record.MaturePublish;
  883. GPD.MembershipFee = record.MembershipFee;
  884. GPD.MemberTitle = GroupRole[0];
  885. GPD.Money = 0;
  886. GPD.Name = record.GroupName;
  887. GPD.OpenEnrollment = record.OpenEnrollment;
  888. GPD.OwnerRole = record.OwnerRoleID;
  889. GPD.PowersMask = ulong.Parse(GroupRole[1]);
  890. GPD.ShowInList = int.Parse(Membership[2]) == 1;
  891. return GPD;
  892. }
  893. [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
  894. public GroupMembershipData GetGroupMembershipData(UUID requestingAgentID, UUID GroupID, UUID AgentID)
  895. {
  896. object remoteValue = DoRemote(requestingAgentID, GroupID, AgentID);
  897. if (remoteValue != null || m_doRemoteOnly)
  898. return (GroupMembershipData)remoteValue;
  899. if (GroupID == UUID.Zero)
  900. GroupID = GetAgentActiveGroup(requestingAgentID, AgentID);
  901. if (GroupID == UUID.Zero)
  902. return null;
  903. QueryTables tables = new QueryTables();
  904. tables.AddTable("osgroup", "osg");
  905. tables.AddTable("osgroupmembership", "osgm", JoinType.Inner, new[,] { { "osg.GroupID", "osgm.GroupID" } });
  906. tables.AddTable("osrole", "osr", JoinType.Inner, new[,] { { "osgm.SelectedRoleID", "osr.RoleID" }, { "osr.GroupID", "osg.GroupID" } });
  907. QueryFilter filter = new QueryFilter();

Large files files are truncated, but you can click here to view the full file