IGroupsData.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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.Collections.Generic;
  28. using OpenSim.Data;
  29. using OpenMetaverse;
  30. namespace OpenSim.Data
  31. {
  32. public class GroupData
  33. {
  34. public UUID GroupID;
  35. public Dictionary<string, string> Data;
  36. }
  37. public class MembershipData
  38. {
  39. public UUID GroupID;
  40. public string PrincipalID;
  41. public Dictionary<string, string> Data;
  42. }
  43. public class RoleData
  44. {
  45. public UUID GroupID;
  46. public UUID RoleID;
  47. public Dictionary<string, string> Data;
  48. }
  49. public class RoleMembershipData
  50. {
  51. public UUID GroupID;
  52. public UUID RoleID;
  53. public string PrincipalID;
  54. }
  55. public class PrincipalData
  56. {
  57. public string PrincipalID;
  58. public UUID ActiveGroupID;
  59. }
  60. public class InvitationData
  61. {
  62. public UUID InviteID;
  63. public UUID GroupID;
  64. public UUID RoleID;
  65. public string PrincipalID;
  66. public Dictionary<string, string> Data;
  67. }
  68. public class NoticeData
  69. {
  70. public UUID GroupID;
  71. public UUID NoticeID;
  72. public Dictionary<string, string> Data;
  73. }
  74. public interface IGroupsData
  75. {
  76. // groups table
  77. bool StoreGroup(GroupData data);
  78. GroupData RetrieveGroup(UUID groupID);
  79. GroupData RetrieveGroup(string name);
  80. GroupData[] RetrieveGroups(string pattern);
  81. bool DeleteGroup(UUID groupID);
  82. int GroupsCount();
  83. // membership table
  84. MembershipData RetrieveMember(UUID groupID, string pricipalID);
  85. MembershipData[] RetrieveMembers(UUID groupID);
  86. MembershipData[] RetrieveMemberships(string pricipalID);
  87. bool StoreMember(MembershipData data);
  88. bool DeleteMember(UUID groupID, string pricipalID);
  89. int MemberCount(UUID groupID);
  90. // roles table
  91. bool StoreRole(RoleData data);
  92. RoleData RetrieveRole(UUID groupID, UUID roleID);
  93. RoleData[] RetrieveRoles(UUID groupID);
  94. bool DeleteRole(UUID groupID, UUID roleID);
  95. int RoleCount(UUID groupID);
  96. // rolememberhip table
  97. RoleMembershipData[] RetrieveRolesMembers(UUID groupID);
  98. RoleMembershipData[] RetrieveRoleMembers(UUID groupID, UUID roleID);
  99. RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID);
  100. RoleMembershipData RetrieveRoleMember(UUID groupID, UUID roleID, string principalID);
  101. int RoleMemberCount(UUID groupID, UUID roleID);
  102. bool StoreRoleMember(RoleMembershipData data);
  103. bool DeleteRoleMember(RoleMembershipData data);
  104. bool DeleteMemberAllRoles(UUID groupID, string principalID);
  105. // principals table
  106. bool StorePrincipal(PrincipalData data);
  107. PrincipalData RetrievePrincipal(string principalID);
  108. bool DeletePrincipal(string principalID);
  109. // invites table
  110. bool StoreInvitation(InvitationData data);
  111. InvitationData RetrieveInvitation(UUID inviteID);
  112. InvitationData RetrieveInvitation(UUID groupID, string principalID);
  113. bool DeleteInvite(UUID inviteID);
  114. void DeleteOldInvites();
  115. // notices table
  116. bool StoreNotice(NoticeData data);
  117. NoticeData RetrieveNotice(UUID noticeID);
  118. NoticeData[] RetrieveNotices(UUID groupID);
  119. bool DeleteNotice(UUID noticeID);
  120. void DeleteOldNotices();
  121. // combinations
  122. MembershipData RetrievePrincipalGroupMembership(string principalID, UUID groupID);
  123. MembershipData[] RetrievePrincipalGroupMemberships(string principalID);
  124. // Misc
  125. }
  126. }