コード例 #1
0
        public List <GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
        {
            Hashtable param = new Hashtable();

            param["GroupID"] = GroupID.ToString();

            Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param);

            List <GroupMembersData> members = new List <GroupMembersData>();

            if (respData.Contains("error"))
            {
                return(members);
            }

            foreach (Hashtable membership in respData.Values)
            {
                GroupMembersData data = new GroupMembersData();

                data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1";
                data.AgentID       = new UUID((string)membership["AgentID"]);
                data.Contribution  = int.Parse((string)membership["Contribution"]);
                data.IsOwner       = ((string)membership["IsOwner"]) == "1";
                data.ListInProfile = ((string)membership["ListInProfile"]) == "1";
                data.AgentPowers   = ulong.Parse((string)membership["AgentPowers"]);
                data.Title         = (string)membership["Title"];

                members.Add(data);
            }

            return(members);
        }
コード例 #2
0
        public List <GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID groupID)
        {
            m_log.DebugFormat(
                "[MOCK GROUPS SERVICES CONNECTOR]: GetGroupMembers, requestingAgentID {0}, groupID {1}",
                requestingAgentID, groupID);

            List <GroupMembersData> groupMembers = new List <GroupMembersData>();

            XGroup group = GetXGroup(groupID, null);

            if (group == null)
            {
                return(groupMembers);
            }

            foreach (XGroupMember xgm in group.members.Values)
            {
                GroupMembersData gmd = new GroupMembersData();
                gmd.AgentID       = xgm.agentID;
                gmd.IsOwner       = group.founderID == gmd.AgentID;
                gmd.AcceptNotices = xgm.acceptNotices;
                gmd.ListInProfile = xgm.listInProfile;

                groupMembers.Add(gmd);
            }

            return(groupMembers);
        }
コード例 #3
0
ファイル: ForeignImporter.cs プロジェクト: BogusCurry/akisim
        public GroupMembersData ConvertGroupMembersData(ExtendedGroupMembersData _m)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            GroupMembersData m = new GroupMembersData();

            m.AcceptNotices = _m.AcceptNotices;
            m.AgentPowers   = _m.AgentPowers;
            m.Contribution  = _m.Contribution;
            m.IsOwner       = _m.IsOwner;
            m.ListInProfile = _m.ListInProfile;
            m.OnlineStatus  = _m.OnlineStatus;
            m.Title         = _m.Title;

            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;

            Util.ParseUniversalUserIdentifier(_m.AgentID, out m.AgentID, out url, out first, out last, out tmp);
            if (url != string.Empty)
            {
                m_UserManagement.AddUser(m.AgentID, first, last, url);
            }

            return(m);
        }
コード例 #4
0
        public GroupMembersData GetAgentGroupMemberData(UUID requestingAgentID, UUID GroupID, UUID AgentID)
        {
            //Permissions
            List <string> OtherPermiss = data.Query(new string[] {
                "GroupID",
                "AgentID"
            }, new object[] {
                GroupID,
                requestingAgentID
            }, "osgroupmembership", "AcceptNotices, Contribution, ListInProfile, SelectedRoleID");

            if (OtherPermiss.Count == 0)
            {
                return(null);
            }

            List <string> Membership = data.Query(new string[] {
                "GroupID",
                "AgentID"
            }, new object[] {
                GroupID,
                AgentID
            }, "osgroupmembership", "AcceptNotices, Contribution, ListInProfile, SelectedRoleID");

            if (Membership.Count == 0)
            {
                return(null);
            }
            List <string> GroupRole = data.Query(new string[] { "RoleID" }, new object[] { Membership[3] }, "osrole", "Title, Powers");

            if (GroupRole.Count == 0)
            {
                return(null);
            }
            List <string> OwnerRoleID = data.Query(new string[] { "GroupID" }, new object[] { GroupID }, "osgroup", "OwnerRoleID");
            bool          IsOwner     = data.Query(new string[] {
                "GroupID",
                "RoleID",
                "AgentID"
            }, new object[] {
                GroupID,
                OwnerRoleID[0],
                AgentID
            }, "osgrouprolemembership", "count(AgentID)")[0] != "0";

            GroupMembersData GMD = new GroupMembersData();

            GMD.AcceptNotices = (Membership[0]) == "1";
            GMD.AgentID       = AgentID;
            GMD.Contribution  = int.Parse(Membership[1]);
            GMD.IsOwner       = IsOwner;
            GMD.ListInProfile = (Membership[2]) == "1";
            GMD.AgentPowers   = ulong.Parse(GroupRole[1]);
            GMD.Title         = GroupRole[0];
            GMD.OnlineStatus  = "(Online)";

            return(GMD);
        }
コード例 #5
0
        public bool CheckGroupPermissions(UUID AgentID, UUID GroupID, ulong Permissions)
        {
            if (GroupID == UUID.Zero)
            {
                return(false);
            }

            if (AgentID == UUID.Zero)
            {
                return(false);
            }

            GroupMembersData GMD    = GetAgentGroupMemberData(AgentID, GroupID, AgentID);
            GroupRecord      record = GetGroupRecord(AgentID, GroupID, null);

            if (Permissions == 0)
            {
                if (GMD != null || record.FounderID == AgentID)
                {
                    return(true);
                }
                return(false);
            }

            if (record != null && record.FounderID == AgentID)
            {
                return(true);
            }

            if (GMD == null)
            {
                return(false);
            }

            if ((GMD.AgentPowers & Permissions) != Permissions)
            {
                return(false);
            }

            return(true);
        }
コード例 #6
0
        public GroupMembersData ConvertGroupMembersData(ExtendedGroupMembersData _m)
        {
            GroupMembersData m = new GroupMembersData();

            m.AcceptNotices = _m.AcceptNotices;
            m.AgentPowers   = _m.AgentPowers;
            m.Contribution  = _m.Contribution;
            m.IsOwner       = _m.IsOwner;
            m.ListInProfile = _m.ListInProfile;
            m.OnlineStatus  = _m.OnlineStatus;
            m.Title         = _m.Title;

            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;

            Util.ParseUniversalUserIdentifier(_m.AgentID, out m.AgentID, out url, out first, out last, out tmp);
            if (url != string.Empty)
            {
                m_UserManagement.AddUser(m.AgentID, first, last, url);
            }

            return(m);
        }
コード例 #7
0
        public List <GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
        {
            m_log.InfoFormat("[Groups] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            List <GroupMembersData> groupMembers = new List <GroupMembersData>();

            osGroup group;

            if (m_Groups.TryGetValue(groupID, out group))
            {
                foreach (osGroupMemberInfo member in group.Members.Values)
                {
                    GroupMembersData data = new GroupMembersData();
                    data.AcceptNotices = member.AcceptNotices;
                    data.AgentID       = member.AgentID;
                    data.Contribution  = member.Contribution;
                    data.IsOwner       = member.Roles.ContainsKey(group.OwnerRoleID);
                    data.ListInProfile = member.ListInProfile;

                    data.AgentPowers = 0;

                    foreach (osgRole role in member.Roles.Values)
                    {
                        data.AgentPowers |= (ulong)role.Powers;
                        if (role.RoleID == member.SelectedTitleRole)
                        {
                            data.Title = role.Title;
                        }
                    }

                    // FIXME: need to look this up.
                    // data.OnlineStatus

                    groupMembers.Add(data);
                }
            }

            return(groupMembers);
        }
コード例 #8
0
        public List <GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
        {
            List <GroupRoleMembersData> RoleMembers = new List <GroupRoleMembersData>();
            List <string>    Roles = data.Query("GroupID", GroupID, "osgrouprolemembership", "RoleID,AgentID");
            GroupMembersData GMD   = GetAgentGroupMemberData(requestingAgentID, GroupID, requestingAgentID);

            for (int i = 0; i < Roles.Count; i += 2)
            {
                GroupRoleMembersData RoleMember = new GroupRoleMembersData();
                RoleMember.RoleID   = UUID.Parse(Roles[i]);
                RoleMember.MemberID = UUID.Parse(Roles[i + 1]);
                List <string> roleInfo           = data.Query("RoleID", RoleMember.RoleID, "osrole", "Powers");
                long          canViewMemebersBit = 140737488355328L;
                long          canDoBit           = long.Parse(roleInfo[0]);
                // if they are a member, they can see everyone, otherwise, only the roles that are supposed to be shown
                if (GMD != null || ((canDoBit & canViewMemebersBit) == canViewMemebersBit || RoleMember.MemberID == requestingAgentID))
                {
                    RoleMembers.Add(RoleMember);
                }
            }

            return(RoleMembers);
        }
コード例 #9
0
        private void OnGridInstantMessage(GridInstantMessage msg)
        {
            // The instant message module will only deliver messages of dialog types:
            // MessageFromAgent, StartTyping, StopTyping, MessageFromObject
            //
            // Any other message type will not be delivered to a client by the
            // Instant Message Module

            UUID regionID = new UUID(msg.RegionID);

            if (m_debugEnabled)
            {
                m_log.DebugFormat("[Groups.Messaging]: {0} called, IM from region {1}",
                                  System.Reflection.MethodBase.GetCurrentMethod().Name, regionID);

                DebugGridInstantMessage(msg);
            }

            // Incoming message from a group
            if ((msg.fromGroup == true) && (msg.dialog == (byte)InstantMessageDialog.SessionSend))
            {
                // We have to redistribute the message across all members of the group who are here
                // on this sim

                UUID GroupID = new UUID(msg.imSessionID);

                Scene      aScene         = m_sceneList[0];
                GridRegion regionOfOrigin = aScene.GridService.GetRegionByUUID(aScene.RegionInfo.ScopeID, regionID);

                List <GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), GroupID);

                //if (m_debugEnabled)
                //    foreach (GroupMembersData m in groupMembers)
                //        m_log.DebugFormat("[Groups.Messaging]: member {0}", m.AgentID);

                foreach (Scene s in m_sceneList)
                {
                    s.ForEachScenePresence(sp =>
                    {
                        // If we got this via grid messaging, it's because the caller thinks
                        // that the root agent is here. We should only send the IM to root agents.
                        if (sp.IsChildAgent)
                        {
                            return;
                        }

                        GroupMembersData m = groupMembers.Find(gmd =>
                        {
                            return(gmd.AgentID == sp.UUID);
                        });
                        if (m.AgentID == UUID.Zero)
                        {
                            if (m_debugEnabled)
                            {
                                m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he is not a member of the group", sp.UUID);
                            }
                            return;
                        }

                        // Check if the user has an agent in the region where
                        // the IM came from, and if so, skip it, because the IM
                        // was already sent via that agent
                        if (regionOfOrigin != null)
                        {
                            AgentCircuitData aCircuit = s.AuthenticateHandler.GetAgentCircuitData(sp.UUID);
                            if (aCircuit != null)
                            {
                                if (aCircuit.ChildrenCapSeeds.Keys.Contains(regionOfOrigin.RegionHandle))
                                {
                                    if (m_debugEnabled)
                                    {
                                        m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he has an agent in region of origin", sp.UUID);
                                    }
                                    return;
                                }
                                else
                                {
                                    if (m_debugEnabled)
                                    {
                                        m_log.DebugFormat("[Groups.Messaging]: not skipping agent {0}", sp.UUID);
                                    }
                                }
                            }
                        }

                        UUID AgentID  = sp.UUID;
                        msg.toAgentID = AgentID.Guid;

                        if (!hasAgentDroppedGroupChatSession(AgentID.ToString(), GroupID))
                        {
                            if (!hasAgentBeenInvitedToGroupChatSession(AgentID.ToString(), GroupID))
                            {
                                AddAgentToSession(AgentID, GroupID, msg);
                            }
                            else
                            {
                                if (m_debugEnabled)
                                {
                                    m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", sp.Name);
                                }

                                ProcessMessageFromGroupSession(msg);
                            }
                        }
                    });
                }
            }
        }
コード例 #10
0
        public GroupMembersData GetAgentGroupMemberData(UUID requestingAgentID, UUID GroupID, UUID AgentID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["METHOD"] = "GetAgentGroupMemberData";
            sendData["requestingAgentID"] = requestingAgentID;
            sendData["GroupID"] = GroupID;
            sendData["AgentID"] = AgentID;

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                           m_ServerURI + "/auroradata",
                           reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            Dictionary<string, object>.ValueCollection replyvalues = replyData.Values;
                            GroupMembersData group = null;
                            foreach (object f in replyvalues)
                            {
                                if (f is Dictionary<string, object>)
                                {
                                    group = new GroupMembersData((Dictionary<string, object>)f);
                                }
                            }
                            // Success
                            return group;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteGroupsServiceConnector]: Exception when contacting server: {0}", e.ToString());
            }

            return null;
        }
コード例 #11
0
        public GroupMembersData GetAgentGroupMemberData(UUID requestingAgentID, UUID GroupID, UUID AgentID)
        {
            //Permissions
            List<string> OtherPermiss = data.Query(new[]
                                                       {
                                                           "GroupID",
                                                           "AgentID"
                                                       }, new object[]
                                                              {
                                                                  GroupID,
                                                                  requestingAgentID
                                                              }, "osgroupmembership",
                                                   "AcceptNotices, Contribution, ListInProfile, SelectedRoleID");
            if (OtherPermiss.Count == 0)
                return null;

            List<string> Membership = data.Query(new[]
                                                     {
                                                         "GroupID",
                                                         "AgentID"
                                                     }, new object[]
                                                            {
                                                                GroupID,
                                                                AgentID
                                                            }, "osgroupmembership",
                                                 "AcceptNotices, Contribution, ListInProfile, SelectedRoleID");
            if (Membership.Count == 0)
                return null;
            List<string> GroupRole = data.Query(new[] { "RoleID", "GroupID" }, new object[] { Membership[3], GroupID }, "osrole",
                                                "Title, Powers");
            if (GroupRole.Count == 0)
                return null;
            List<string> OwnerRoleID = data.Query(new[] {"GroupID"}, new object[] {GroupID}, "osgroup", "OwnerRoleID");
            bool IsOwner = data.Query(new[]
                                          {
                                              "GroupID",
                                              "RoleID",
                                              "AgentID"
                                          }, new object[]
                                                 {
                                                     GroupID,
                                                     OwnerRoleID[0],
                                                     AgentID
                                                 }, "osgrouprolemembership", "count(AgentID)")[0] != "0";

            GroupMembersData GMD = new GroupMembersData
                                       {
                                           AcceptNotices = (Membership[0]) == "1",
                                           AgentID = AgentID,
                                           Contribution = int.Parse(Membership[1]),
                                           IsOwner = IsOwner,
                                           ListInProfile = (Membership[2]) == "1",
                                           AgentPowers = ulong.Parse(GroupRole[1]),
                                           Title = GroupRole[0],
                                           OnlineStatus = "(Online)"
                                       };


            return GMD;
        }
コード例 #12
0
        public GroupMembersData GetAgentGroupMemberData(UUID requestingAgentID, UUID GroupID, UUID AgentID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["METHOD"] = "GetAgentGroupMemberData";
            sendData["requestingAgentID"] = requestingAgentID;
            sendData["GroupID"] = GroupID;
            sendData["AgentID"] = AgentID;

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                List<string> m_ServerURIs =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(
                        requestingAgentID.ToString(), "RemoteServerURI", false);
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                                                                             m_ServerURI,
                                                                             reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            Dictionary<string, object>.ValueCollection replyvalues = replyData.Values;
                            GroupMembersData group = null;
#if (!ISWIN)
                            foreach (object replyvalue in replyvalues)
                            {
                                Dictionary<string, object> f = replyvalue as Dictionary<string, object>;
                                if (f != null)
                                {
                                    group = new GroupMembersData(f);
                                }
                            }
#else
                            foreach (Dictionary<string, object> f in replyvalues.OfType<Dictionary<string, object>>())
                            {
                                group = new GroupMembersData(f);
                            }
#endif
                            // Success
                            return group;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteGroupsServiceConnector]: Exception when contacting server: {0}", e);
            }

            return null;
        }