[Opensim-dev] Proposed feature addition to OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs (patch included)

James Stallings II james.stallings at gmail.com
Sat May 28 01:07:08 UTC 2011


Justin,

I'm actually using a couple of repos locally, so it was fairly simple to
reset one to a point just before where I was working and simply update that
commit with my final changes, thus taking the failed work (and the patch to
the patch) out of the loop.

As per your secondary instructions in skype, I used git show <commit ID>
<file> to produce the following patch for
OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs:

--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -1231,20 +1231,36 @@ namespace
OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             List<GroupMembershipData> membershipData =
m_groupData.GetAgentGroupMemberships(requestingClient.AgentId,
dataForAgentID);
             GroupMembershipData[] membershipArray;

-            if (requestingClient.AgentId != dataForAgentID)
-            {
+            //  c_scene and property accessor 'is_god' are in support of
the opertions to bypass 'hidden' group attributes for
+            // those with a GodLike aspect.
+            Scene c_scene = (Scene) requestingClient.Scene;
+            bool is_god =
c_scene.Permissions.IsGod(requestingClient.AgentId);
+
+            if(is_god) {
                 Predicate<GroupMembershipData> showInProfile =
delegate(GroupMembershipData membership)
                 {
                     return membership.ListInProfile;
                 };

-                membershipArray =
membershipData.FindAll(showInProfile).ToArray();
+                membershipArray = membershipData.ToArray();
             }
             else
             {
-                membershipArray = membershipData.ToArray();
-            }

+                if (requestingClient.AgentId != dataForAgentID)
+                {
+                    Predicate<GroupMembershipData> showInProfile =
delegate(GroupMembershipData membership)
+                    {
+                        return membership.ListInProfile;
+                    };
+
+                    membershipArray =
membershipData.FindAll(showInProfile).ToArray();
+                }
+                else
+                {
+                    membershipArray = membershipData.ToArray();
+                }
+            }
             if (m_debugEnabled)
             {
                 m_log.InfoFormat("[GROUPS]: Get group membership
information for {0} requested by {1}", dataForAgentID,
requestingClient.AgentId);
@@ -1257,6 +1273,7 @@ namespace
OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             return membershipArray;
         }

+
         private void SendAgentDataUpdate(IClientAPI remoteClient, UUID
dataForAgentID, UUID activeGroupID, string activeGroupName, ulong
activeGroupPowers, string activeGroupTitle)
         {
             if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called",
System.Reflection.MethodBase.GetCurrentMethod().Name);


Let me know if this is the right sort of thing. Note that I cut a few lines
from the top that git output to the patchfile, that I cut out. They may be
necessary Idk, but if so let me know and I'll save them before I make a
redux on the mantis site.

Cheers Justin!
James



On Fri, May 27, 2011 at 7:08 PM, James Stallings II <
james.stallings at gmail.com> wrote:

> Thanks Justin,
>
> Will do just shortly.
>
> Cheers!
> James
>
>
> On Fri, May 27, 2011 at 7:08 PM, Justin Clark-Casey <
> jjustincc at googlemail.com> wrote:
>
>> Yes, please could you consolidate the patches (from a brief look it
>> appears that later ones are now editing earlier ones) and attach to a
>> mantis, which should be in patch included state.
>>
>> The best way to generate a suitable patch is to use
>>
>> git am <commit uuid>^
>>
>> on the command line.
>>
>>
>> On 27/05/11 02:01, James Stallings II wrote:
>>
>>> Just a quick apology to the list for the oldskool diff, Melanie_T tells
>>> me I should use udiff, and next time, I will.
>>>
>>> Cheers!
>>> James/Hiro
>>>
>>> On Thu, May 26, 2011 at 6:19 PM, James Stallings II <
>>> james.stallings at gmail.com <mailto:james.stallings at gmail.com>> wrote:
>>>
>>>    My apologies, but the previous code was completely ineffective on
>>> testing. I know, it should be tested before
>>>    submission. Mea Culpa, it looked really good.
>>>
>>>    This, however, actually works:
>>>
>>>    1103d1102
>>>    <
>>>    1117,1125c1116,1125
>>>    <
>>>    <                if (GetRequestingAgentID(remoteClient) !=
>>> dataForAgentID)
>>>    <                {
>>>    <                    if (!membership.ListInProfile)
>>>    <                    {
>>>    <                       // If we're sending group info to remoteclient
>>> about another agent,
>>>    <                       // filter out groups the other agent doesn't
>>> want to share.
>>>    <                       continue;
>>>    <                    }
>>>    ---
>>>     >                 if
>>> (!remoteClient.Scene.Permissions.IsGod(remoteClient.AgentID))
>>>     >                     if (GetRequestingAgentID(remoteClient) !=
>>> dataForAgentID)
>>>     >                     {
>>>     >                         if (!membership.ListInProfile)
>>>     >                         {
>>>     >                             // If we're sending group info to
>>> remoteclient about another agent,
>>>     >                             // filter out groups the other agent
>>> doesn't want to share.
>>>     >                             continue;
>>>     >                         }
>>>     >                     }
>>>    1128d1127
>>>    <
>>>    1237,1242c1236,1237
>>>    <             //  c_scene and property accessor 'is_god' are in
>>> support of the opertions to bypass 'hidden' group
>>>    attributes for
>>>    <             // those with a GodLike aspect.
>>>    <             Scene c_scene = (Scene) requestingClient.Scene;
>>>    <             bool is_god =
>>> c_scene.Permissions.IsGod(requestingClient.AgentId);
>>>    <
>>>    <             if(is_god) {
>>>    ---
>>>     >             if (requestingClient.AgentId != dataForAgentID)
>>>     >             {
>>>    1248c1243
>>>    <                 membershipArray = membershipData.ToArray();
>>>    ---
>>>     >                 membershipArray =
>>> membershipData.FindAll(showInProfile).ToArray();
>>>    1252,1265c1247
>>>    <
>>>    <                 if (requestingClient.AgentId != dataForAgentID)
>>>    <                 {
>>>    <                     Predicate<GroupMembershipData> showInProfile =
>>> delegate(GroupMembershipData membership)
>>>    <                     {
>>>    <                         return membership.ListInProfile;
>>>    <                     };
>>>    <
>>>    <                     membershipArray =
>>> membershipData.FindAll(showInProfile).ToArray();
>>>    <                 }
>>>    <                 else
>>>    <                 {
>>>    <                     membershipArray = membershipData.ToArray();
>>>    <                 }
>>>    ---
>>>     >                 membershipArray = membershipData.ToArray();
>>>    1266a1249
>>>     >
>>>
>>>    On Thu, May 26, 2011 at 11:36 AM, James Stallings II <
>>> james.stallings at gmail.com <mailto:james.stallings at gmail.com>>
>>>
>>>    wrote:
>>>
>>>        Greetings, OpenSimulator developers :)
>>>
>>>        I'm writing to propose the addition of certain functionality
>>>        to
>>> OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs, to wit:
>>>
>>>        Present 'Hidden' groups and other related group detail to agents
>>> requesting such iniformation via CAPs as have
>>>        assumed a 'godlike' aspect, or in other words, have successfully
>>> activated the administrative functionality in
>>>        the client.
>>>
>>>        The changes to the substance of the code involve credits more than
>>> not; a diff is both attached and included for
>>>        convenient review. A fork has been created on github at git://
>>> github.com/JamesStallings/opensim.git
>>>        <http://github.com/JamesStallings/opensim.git> which contains the
>>> changes for convenience should contribution of
>>>
>>>        source be accepted. I will also open a mantis on the topic for the
>>> sake of thoroughness and attach the diff there.
>>>
>>>
>>>        Many thanks and cheers!
>>>
>>>        James Stallings aka Hiro Protagonist
>>>
>>>
>>>        Diff follows:
>>>
>>>        1103,1107d1102
>>>        <             //  c_scene and property accessor 'is_god' are in
>>> support of the opertions to bypass 'hidden'
>>>        group attributes for
>>>        <             // those with a GodLike aspect.
>>>        <             Scene c_scene = (Scene) remoteClient.Scene;
>>>        <             bool is_god =
>>> c_scene.Permissions.IsGod(remoteClient.AgentId);
>>>        <
>>>        1121,1138c1116,1126
>>>        < //              bypass the 'hidden' attributes of groups for
>>> those who have
>>>        < //              a GodLike aspect
>>>        < //
>>>        < //              Big shout out to Dan Banner for showing me his
>>> running proof-of-concept and endorsing this
>>>        idea as meaningful work
>>>        < //              Another big shout out to BlueWall Slade for
>>> helping me chase down all the elements required to
>>>        properly access
>>>        < //              Scene and IClientAPI properties.  JS aka HP
>>>        <                 if (!is_god)
>>>        <                 {
>>>        <                if (GetRequestingAgentID(remoteClient) !=
>>> dataForAgentID)
>>>        <        {
>>>        <    if (!membership.ListInProfile)
>>>        <                    {
>>>        <                // If we're sending group info to remoteclient
>>> about another agent,
>>>        <        // filter out groups the other agent doesn't want to
>>> share.
>>>        < continue;
>>>        <                    }
>>>        <        }
>>>        < }
>>>        ---
>>>         >                 if
>>> (!remoteClient.Scene.Permissions.IsGod(remoteClient.AgentID))
>>>         >                     if (GetRequestingAgentID(remoteClient) !=
>>> dataForAgentID)
>>>         >                     {
>>>         >                         if (!membership.ListInProfile)
>>>         >                         {
>>>         >                             // If we're sending group info to
>>> remoteclient about another agent,
>>>         >                             // filter out groups the other
>>> agent doesn't want to share.
>>>         >                             continue;
>>>         >                         }
>>>         >                     }
>>>         >                 }
>>>
>>>
>>>        --
>>>        ===================================
>>>        http://simhost.com http://osgrid.org
>>>        http://twitter.com/jstallings2
>>>        http://www.linkedin.com/pub/5/770/a49
>>>
>>>
>>>
>>>
>>>    --
>>>    ===================================
>>>    http://simhost.com http://osgrid.org
>>>    http://twitter.com/jstallings2
>>>    http://www.linkedin.com/pub/5/770/a49
>>>
>>>
>>>
>>>
>>> --
>>> ===================================
>>> http://simhost.com http://osgrid.org
>>> http://twitter.com/jstallings2
>>> http://www.linkedin.com/pub/5/770/a49
>>>
>>>
>>>
>>> _______________________________________________
>>> Opensim-dev mailing list
>>> Opensim-dev at lists.berlios.de
>>> https://lists.berlios.de/mailman/listinfo/opensim-dev
>>>
>>
>>
>> --
>> Justin Clark-Casey (justincc)
>> http://justincc.org/blog
>> http://twitter.com/justincc
>> _______________________________________________
>> Opensim-dev mailing list
>> Opensim-dev at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/opensim-dev
>>
>
>
>
> --
> ===================================
> http://simhost.com http://osgrid.org
> http://twitter.com/jstallings2
> http://www.linkedin.com/pub/5/770/a49
>



-- 
===================================
http://simhost.com http://osgrid.org
http://twitter.com/jstallings2
http://www.linkedin.com/pub/5/770/a49
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20110527/5d87938b/attachment-0001.html>


More information about the Opensim-dev mailing list