29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
32 using OpenSim.Framework;
37 namespace OpenSim.Data.PGSQL
63 return m_Groups.Store(data);
68 GroupData[] groups = m_Groups.Get(
"GroupID", groupID.ToString());
69 if (groups.Length > 0)
77 GroupData[] groups = m_Groups.Get(
"Name", name);
78 if (groups.Length > 0)
87 if (
string.IsNullOrEmpty(pattern))
89 pattern =
" 1 ORDER BY lower(\"Name\") LIMIT 100";
91 return m_Groups.Get(pattern);
95 pattern =
" \"ShowInList\" = 1 AND lower(\"Name\") LIKE lower('%" + pattern +
"%') ORDER BY lower(\"Name\") LIMIT 100";
97 return m_Groups.Get(pattern,
new NpgsqlParameter(
"pattern", pattern));
103 return m_Groups.Delete(
"GroupID", groupID.ToString());
108 return (
int)m_Groups.GetCount(
" \"Location\" = \"\"");
113 #region membership table
116 return m_Membership.Get(
"GroupID", groupID.ToString());
121 MembershipData[] m = m_Membership.Get(
new string[] {
"GroupID",
"PrincipalID" },
122 new string[] { groupID.ToString(), pricipalID });
123 if (m != null && m.Length > 0)
131 return m_Membership.Get(
"PrincipalID", pricipalID.ToString());
136 return m_Membership.Store(data);
141 return m_Membership.Delete(
new string[] {
"GroupID",
"PrincipalID" },
142 new string[] { groupID.ToString(), pricipalID });
147 return (
int)m_Membership.GetCount(
"GroupID", groupID.ToString());
154 return m_Roles.Store(data);
159 RoleData[] data = m_Roles.Get(
new string[] {
"GroupID",
"RoleID" },
160 new string[] { groupID.ToString(), roleID.ToString() });
162 if (data != null && data.Length > 0)
171 return m_Roles.Get(
"GroupID", groupID.ToString());
176 return m_Roles.Delete(
new string[] {
"GroupID",
"RoleID" },
177 new string[] { groupID.ToString(), roleID.ToString() });
182 return (
int)m_Roles.GetCount(
"GroupID", groupID.ToString());
188 #region rolememberhip table
198 RoleMembershipData[] data = m_RoleMembership.Get(
new string[] {
"GroupID",
"RoleID" },
199 new string[] { groupID.ToString(), roleID.ToString() });
206 RoleMembershipData[] data = m_RoleMembership.Get(
new string[] {
"GroupID",
"PrincipalID" },
207 new string[] { groupID.ToString(), principalID.ToString() });
214 RoleMembershipData[] data = m_RoleMembership.Get(
new string[] {
"GroupID",
"RoleID",
"PrincipalID" },
215 new string[] { groupID.ToString(), roleID.ToString(), principalID.ToString() });
217 if (data != null && data.Length > 0)
225 return (
int)m_RoleMembership.GetCount(
new string[] {
"GroupID",
"RoleID" },
226 new string[] { groupID.ToString(), roleID.ToString() });
231 return m_RoleMembership.Store(data);
236 return m_RoleMembership.Delete(
new string[] {
"GroupID",
"RoleID",
"PrincipalID"},
237 new string[] { data.GroupID.ToString(), data.
RoleID.ToString(), data.PrincipalID });
242 return m_RoleMembership.Delete(
new string[] {
"GroupID",
"PrincipalID" },
243 new string[] { groupID.ToString(), principalID });
248 #region principals table
251 return m_Principals.Store(data);
256 PrincipalData[] p = m_Principals.Get(
"PrincipalID", principalID);
257 if (p != null && p.Length > 0)
265 return m_Principals.Delete(
"PrincipalID", principalID);
269 #region invites table
273 return m_Invites.Store(data);
278 InvitationData[] invites = m_Invites.Get(
"InviteID", inviteID.ToString());
280 if (invites != null && invites.Length > 0)
288 InvitationData[] invites = m_Invites.Get(
new string[] {
"GroupID",
"PrincipalID" },
289 new string[] { groupID.ToString(), principalID });
291 if (invites != null && invites.Length > 0)
299 return m_Invites.Delete(
"InviteID", inviteID.ToString());
304 m_Invites.DeleteOld();
309 #region notices table
313 return m_Notices.Store(data);
318 NoticeData[] notices = m_Notices.Get(
"NoticeID", noticeID.ToString());
320 if (notices != null && notices.Length > 0)
328 NoticeData[] notices = m_Notices.Get(
"GroupID", groupID.ToString());
335 return m_Notices.Delete(
"NoticeID", noticeID.ToString());
340 m_Notices.DeleteOld();
362 protected override Assembly Assembly
365 get {
return GetType().Assembly; }
369 : base(connectionString, realm, store)
377 protected override Assembly Assembly
380 get {
return GetType().Assembly; }
384 : base(connectionString, realm, string.Empty)
392 protected override Assembly Assembly
395 get {
return GetType().Assembly; }
399 : base(connectionString, realm, string.Empty)
407 protected override Assembly Assembly
410 get {
return GetType().Assembly; }
414 : base(connectionString, realm, string.Empty)
422 protected override Assembly Assembly
425 get {
return GetType().Assembly; }
429 : base(connectionString, realm, string.Empty)
436 using (NpgsqlCommand cmd =
new NpgsqlCommand())
438 cmd.CommandText = String.Format(
"delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
440 ExecuteNonQuery(cmd);
448 protected override Assembly Assembly
451 get {
return GetType().Assembly; }
455 : base(connectionString, realm, string.Empty)
462 using (NpgsqlCommand cmd =
new NpgsqlCommand())
464 cmd.CommandText = String.Format(
"delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
466 ExecuteNonQuery(cmd);
474 protected override Assembly Assembly
477 get {
return GetType().Assembly; }
481 : base(connectionString, realm, string.Empty)
bool DeleteRoleMember(RoleMembershipData data)
InvitationData RetrieveInvitation(UUID groupID, string principalID)
bool DeleteInvite(UUID inviteID)
PGSqlGroupsNoticesHandler(string connectionString, string realm)
RoleMembershipData RetrieveRoleMember(UUID groupID, UUID roleID, string principalID)
RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID)
bool DeleteRole(UUID groupID, UUID roleID)
NoticeData RetrieveNotice(UUID noticeID)
InvitationData RetrieveInvitation(UUID inviteID)
PGSqlGroupsGroupsHandler(string connectionString, string realm, string store)
bool StoreInvitation(InvitationData data)
PGSQLGroupsData(string connectionString, string realm)
bool StoreNotice(NoticeData data)
RoleData RetrieveRole(UUID groupID, UUID roleID)
PGSqlGroupsInvitesHandler(string connectionString, string realm)
RoleMembershipData[] RetrieveRoleMembers(UUID groupID, UUID roleID)
int MemberCount(UUID groupID)
RoleMembershipData[] RetrieveRolesMembers(UUID groupID)
MembershipData RetrieveMember(UUID groupID, string pricipalID)
bool StoreRole(RoleData data)
int RoleCount(UUID groupID)
bool DeleteGroup(UUID groupID)
bool StorePrincipal(PrincipalData data)
PGSqlGroupsPrincipalsHandler(string connectionString, string realm)
bool DeleteNotice(UUID noticeID)
int RoleMemberCount(UUID groupID, UUID roleID)
MembershipData[] RetrieveMemberships(string pricipalID)
GroupData RetrieveGroup(string name)
PGSqlGroupsMembershipHandler(string connectionString, string realm)
PGSqlGroupsRolesHandler(string connectionString, string realm)
bool DeleteMemberAllRoles(UUID groupID, string principalID)
MembershipData[] RetrievePrincipalGroupMemberships(string principalID)
GroupData[] RetrieveGroups(string pattern)
MembershipData[] RetrieveMembers(UUID groupID)
bool DeleteMember(UUID groupID, string pricipalID)
GroupData RetrieveGroup(UUID groupID)
bool DeletePrincipal(string principalID)
MembershipData RetrievePrincipalGroupMembership(string principalID, UUID groupID)
PGSqlGroupsRoleMembershipHandler(string connectionString, string realm)
RoleData[] RetrieveRoles(UUID groupID)
PrincipalData RetrievePrincipal(string principalID)
NoticeData[] RetrieveNotices(UUID groupID)
bool StoreRoleMember(RoleMembershipData data)
bool StoreGroup(GroupData data)
bool StoreMember(MembershipData data)