mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
add GetFullGroupPowers(agentID, groupID) to groups modules. This returns the 'sum' of powers of all agent roles on that group, apply it to some OSSL (mantis 8777). It May be needed elsewhere
This commit is contained in:
@@ -763,6 +763,31 @@ namespace OpenSim.Groups
|
||||
return data;
|
||||
}
|
||||
|
||||
public ulong GetFullGroupPowers(UUID agentID, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
List<GroupRolesData> data = m_groupData.GetGroupRoles(agentID.ToString(), groupID);
|
||||
if (data == null || data.Count == 0)
|
||||
return 0;
|
||||
|
||||
ulong powers = 0;
|
||||
for (int i = 0; i < data.Count; ++i)
|
||||
{
|
||||
powers |= data[i].Powers;
|
||||
}
|
||||
return powers;
|
||||
}
|
||||
|
||||
public List<GroupRolesData> GroupRoleDataRequest(UUID agentID, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
List<GroupRolesData> data = m_groupData.GetGroupRoles(agentID.ToString(), groupID);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
@@ -268,10 +268,17 @@ namespace OpenSim.Groups
|
||||
sendData["METHOD"] = method;
|
||||
|
||||
string reply = string.Empty;
|
||||
lock (m_Lock)
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
try
|
||||
{
|
||||
lock (m_Lock)
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "hg-groups",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[XXX]: reply was {0}", reply);
|
||||
|
||||
|
||||
@@ -99,6 +99,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
void InviteGroup(IClientAPI remoteClient, UUID agentID, UUID GroupID, UUID InviteeID, UUID RoleID);
|
||||
void NotifyChange(UUID GroupID);
|
||||
|
||||
ulong GetFullGroupPowers(UUID agentID, UUID groupID);
|
||||
List<GroupRolesData> GroupRoleDataRequest(UUID agentID, UUID groupID);
|
||||
|
||||
List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query);
|
||||
}
|
||||
}
|
||||
@@ -874,6 +874,31 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
return data;
|
||||
}
|
||||
|
||||
public ulong GetFullGroupPowers(UUID agentID, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
List<GroupRolesData> data = m_groupData.GetGroupRoles(agentID, groupID);
|
||||
if (data == null || data.Count == 0)
|
||||
return 0;
|
||||
|
||||
ulong powers = 0;
|
||||
for (int i = 0; i < data.Count; ++i)
|
||||
{
|
||||
powers |= data[i].Powers;
|
||||
}
|
||||
return powers;
|
||||
}
|
||||
|
||||
public List<GroupRolesData> GroupRoleDataRequest(UUID agentID, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
List<GroupRolesData> data = m_groupData.GetGroupRoles(agentID, groupID);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
@@ -4101,9 +4101,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (sp.ControllingClient.IsGroupMember(m_host.GroupID))
|
||||
return 2;
|
||||
|
||||
// object owner has to be in that group and required permissions
|
||||
GroupMembershipData member = m_groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
|
||||
if (member == null || (member.GroupPowers & (ulong)GroupPowers.Invite) == 0)
|
||||
// object owner needs invite power
|
||||
ulong ownerPowers = m_groupsModule.GetFullGroupPowers(m_host.OwnerID, m_host.GroupID);
|
||||
if ((ownerPowers & (ulong)GroupPowers.Invite) == 0)
|
||||
return ScriptBaseClass.FALSE;
|
||||
|
||||
m_groupsModule.InviteGroup(null, m_host.OwnerID, m_host.GroupID, agent, UUID.Zero);
|
||||
@@ -4132,9 +4132,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID)
|
||||
return ScriptBaseClass.FALSE;
|
||||
|
||||
// object owner has to be in that group and required permissions
|
||||
GroupMembershipData member = m_groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
|
||||
if (member == null || (member.GroupPowers & (ulong)GroupPowers.Eject) == 0)
|
||||
// object owner needs eject power
|
||||
ulong ownerPowers = m_groupsModule.GetFullGroupPowers(m_host.OwnerID, m_host.GroupID);
|
||||
if ((ownerPowers & (ulong)GroupPowers.Eject) == 0)
|
||||
return ScriptBaseClass.FALSE;
|
||||
|
||||
m_groupsModule.EjectGroupMember(null, m_host.OwnerID, m_host.GroupID, agent);
|
||||
|
||||
Reference in New Issue
Block a user