public GroupProfileData GetGroupProfile(UUID requestingAgentID, UUID GroupID)
        {
            object remoteValue = DoRemote(requestingAgentID, GroupID);
            if (remoteValue != null || m_doRemoteOnly)
                return (GroupProfileData)remoteValue;

            GroupProfileData profile = new GroupProfileData();

            GroupRecord groupInfo = GetGroupRecord(requestingAgentID, GroupID, null);
            if (groupInfo != null)
            {
                profile.AllowPublish = groupInfo.AllowPublish;
                profile.Charter = groupInfo.Charter;
                profile.FounderID = groupInfo.FounderID;
                profile.GroupID = GroupID;
                profile.GroupMembershipCount =
                    GetGroupMembers(requestingAgentID, GroupID).Count;
                profile.GroupRolesCount = GetGroupRoles(requestingAgentID, GroupID).Count;
                profile.InsigniaID = groupInfo.GroupPicture;
                profile.MaturePublish = groupInfo.MaturePublish;
                profile.MembershipFee = groupInfo.MembershipFee;
                profile.Money = 0; // TODO: Get this from the currency server?
                profile.Name = groupInfo.GroupName;
                profile.OpenEnrollment = groupInfo.OpenEnrollment;
                profile.OwnerRole = groupInfo.OwnerRoleID;
                profile.ShowInList = groupInfo.ShowInList;
            }

            GroupMembershipData memberInfo = GetGroupMembershipData(requestingAgentID,
                                                                                 GroupID,
                                                                                 requestingAgentID);
            if (memberInfo != null)
            {
                profile.MemberTitle = memberInfo.GroupTitle;
                profile.PowersMask = memberInfo.GroupPowers;
            }

            return profile;
        }
        public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
        {
            object remoteValue = DoRemote(requestingAgentID, GroupID, AgentID);
            if (remoteValue != null || m_doRemoteOnly)
                return (GroupProfileData)remoteValue;

            if (!CheckGroupPermissions(requestingAgentID, GroupID, (ulong)GroupPowers.MemberVisible))
                return new GroupProfileData();

            GroupProfileData GPD = new GroupProfileData();
            GroupRecord record = GetGroupRecord(requestingAgentID, GroupID, null);

            QueryFilter filter1 = new QueryFilter();
            filter1.andFilters["GroupID"] = AgentID; // yes these look the wrong way around
            filter1.andFilters["AgentID"] = GroupID; // but they were like that when I got here! ~ SignpostMarv

            QueryFilter filter2 = new QueryFilter();
            filter2.andFilters["GroupID"] = GroupID;

            List<string> Membership = data.Query(new[]{
                "Contribution",
                "ListInProfile",
                "SelectedRoleID"
            }, "osgroupmembership", filter1, null, null, null);

            int GroupMemCount = int.Parse(data.Query(new[] { "COUNT(AgentID)" }, "osgroupmembership", filter2, null, null, null)[0]);

            int GroupRoleCount = int.Parse(data.Query(new[] { "COUNT(RoleID)" }, "osrole", filter2, null, null, null)[0]);

            QueryFilter filter3 = new QueryFilter();
            filter3.andFilters["RoleID"] = Membership[2];
            List<string> GroupRole = data.Query(new[] {
                "Name",
                "Powers"
            }, "osrole", filter3, null, null, null);

            GPD.AllowPublish = record.AllowPublish;
            GPD.Charter = record.Charter;
            GPD.FounderID = record.FounderID;
            GPD.GroupID = record.GroupID;
            GPD.GroupMembershipCount = GroupMemCount;
            GPD.GroupRolesCount = GroupRoleCount;
            GPD.InsigniaID = record.GroupPicture;
            GPD.MaturePublish = record.MaturePublish;
            GPD.MembershipFee = record.MembershipFee;
            GPD.MemberTitle = GroupRole[0];
            GPD.Money = 0;

            GPD.Name = record.GroupName;
            GPD.OpenEnrollment = record.OpenEnrollment;
            GPD.OwnerRole = record.OwnerRoleID;
            GPD.PowersMask = ulong.Parse(GroupRole[1]);
            GPD.ShowInList = int.Parse(Membership[2]) == 1;

            return GPD;
        }
        public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["METHOD"] = "GetMemberGroupProfile";
            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 mServerUri in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST", mServerUri, reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);
                        if (replyData != null)
                        {
                            Dictionary<string, object>.ValueCollection replyvalues = replyData.Values;
                            foreach (object f in replyvalues)
                            {
                                if (f is Dictionary<string, object>)
                                {
                                    GroupProfileData @group = new GroupProfileData((Dictionary<string, object>) f);
                                    // Success
                                    return group;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteGroupsServiceConnector]: Exception when contacting server: {0}", e);
            }

            return null;
        }
        private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
        {
            GroupProfileData group = new GroupProfileData();
            group.GroupID = UUID.Parse((string) groupProfile["GroupID"]);
            group.Name = (string) groupProfile["Name"];

            if (groupProfile["Charter"] != null)
            {
                group.Charter = (string) groupProfile["Charter"];
            }

            group.ShowInList = ((string) groupProfile["ShowInList"]) == "1";
            group.InsigniaID = UUID.Parse((string) groupProfile["InsigniaID"]);
            group.MembershipFee = int.Parse((string) groupProfile["MembershipFee"]);
            group.OpenEnrollment = ((string) groupProfile["OpenEnrollment"]) == "1";
            group.AllowPublish = ((string) groupProfile["AllowPublish"]) == "1";
            group.MaturePublish = ((string) groupProfile["MaturePublish"]) == "1";
            group.FounderID = UUID.Parse((string) groupProfile["FounderID"]);
            group.OwnerRole = UUID.Parse((string) groupProfile["OwnerRoleID"]);

            group.GroupMembershipCount = int.Parse((string) groupProfile["GroupMembershipCount"]);
            group.GroupRolesCount = int.Parse((string) groupProfile["GroupRolesCount"]);

            return group;
        }
        public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID groupID, UUID memberID)
        {
            if (m_debugEnabled) MainConsole.Instance.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]  {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            OSDMap groupProfile;
            string groupName;
            if (!SimianGetFirstGenericEntry(groupID, "Group", out groupName, out groupProfile))
            {
                // GroupProfileData is not nullable
                return new GroupProfileData();
            }

            GroupProfileData MemberGroupProfile = new GroupProfileData {GroupID = groupID, Name = groupName};

            if (groupProfile["Charter"] != null)
            {
                MemberGroupProfile.Charter = groupProfile["Charter"].AsString();
            }

            MemberGroupProfile.ShowInList = groupProfile["ShowInList"].AsString() == "1";
            MemberGroupProfile.InsigniaID = groupProfile["InsigniaID"].AsUUID();
            MemberGroupProfile.MembershipFee = groupProfile["MembershipFee"].AsInteger();
            MemberGroupProfile.OpenEnrollment = groupProfile["OpenEnrollment"].AsBoolean();
            MemberGroupProfile.AllowPublish = groupProfile["AllowPublish"].AsBoolean();
            MemberGroupProfile.MaturePublish = groupProfile["MaturePublish"].AsBoolean();
            MemberGroupProfile.FounderID = groupProfile["FounderID"].AsUUID(); ;
            MemberGroupProfile.OwnerRole = groupProfile["OwnerRoleID"].AsUUID();

            Dictionary<UUID, OSDMap> Members;
            if (SimianGetGenericEntries("GroupMember", groupID.ToString(), out Members))
            {
                MemberGroupProfile.GroupMembershipCount = Members.Count;
            }

            Dictionary<string, OSDMap> Roles;
            if (SimianGetGenericEntries(groupID, "GroupRole", out Roles))
            {
                MemberGroupProfile.GroupRolesCount = Roles.Count;
            }

            // TODO: Get Group Money balance from somewhere
            // group.Money = 0;

            GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, memberID, groupID);

            MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
            MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;

            return MemberGroupProfile;
        }
Esempio n. 6
0
        public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID)
        {
            if (m_debugEnabled) MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);

            GroupProfileData profile = new GroupProfileData();


            GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null);
            if (groupInfo != null)
            {
                profile.AllowPublish = groupInfo.AllowPublish;
                profile.Charter = groupInfo.Charter;
                profile.FounderID = groupInfo.FounderID;
                profile.GroupID = groupID;
                profile.GroupMembershipCount =
                    m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID).Count;
                profile.GroupRolesCount = m_groupData.GetGroupRoles(GetRequestingAgentID(remoteClient), groupID).Count;
                profile.InsigniaID = groupInfo.GroupPicture;
                profile.MaturePublish = groupInfo.MaturePublish;
                profile.MembershipFee = groupInfo.MembershipFee;
                profile.Money = 0; // TODO: Get this from the currency server?
                profile.Name = groupInfo.GroupName;
                profile.OpenEnrollment = groupInfo.OpenEnrollment;
                profile.OwnerRole = groupInfo.OwnerRoleID;
                profile.ShowInList = groupInfo.ShowInList;
            }

            GroupMembershipData memberInfo = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient),
                                                                                 GetRequestingAgentID(remoteClient),
                                                                                 groupID);
            if (memberInfo != null)
            {
                profile.MemberTitle = memberInfo.GroupTitle;
                profile.PowersMask = memberInfo.GroupPowers;
            }

            return profile;
        }
        public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
        {
            if (!CheckGroupPermissions(requestingAgentID, GroupID, (ulong) GroupPowers.MemberVisible))
                return new GroupProfileData();

            GroupProfileData GPD = new GroupProfileData();
            GroupRecord record = GetGroupRecord(requestingAgentID, GroupID, null);

            Dictionary<string, object> where = new Dictionary<string, object>(2);
            where["GroupID"] = AgentID; // yes these look the wrong way around
            where["AgentID"] = GroupID; // but they were like that when I got here! ~ SignpostMarv

            Dictionary<string, object> where2 = new Dictionary<string, object>(1);
            where["GroupID"] = GroupID;

            List<string> Membership = data.Query(new string[3]{
                "Contribution",
                "ListInProfile",
                "SelectedRoleID"
            }, "osgroupmembership", new QueryFilter
            {
                andFilters = where
            }, null, null, null);

            int GroupMemCount = int.Parse(data.Query(new string[] { "COUNT(AgentID)" }, "osgroupmembership", new QueryFilter
            {
                andFilters = where2
            }, null, null, null)[0]);

            int GroupRoleCount = int.Parse(data.Query(new string[] { "COUNT(RoleID)" }, "osrole", new QueryFilter
            {
                andFilters = where2
            }, null, null, null)[0]);

            Dictionary<string, object> where3 = new Dictionary<string, object>(1);
            List<string> GroupRole = data.Query(new string[] {
                "Name",
                "Powers"
            }, "osrole", new QueryFilter
            {
                andFilters = where3
            }, null, null, null);

            GPD.AllowPublish = record.AllowPublish;
            GPD.Charter = record.Charter;
            GPD.FounderID = record.FounderID;
            GPD.GroupID = record.GroupID;
            GPD.GroupMembershipCount = GroupMemCount;
            GPD.GroupRolesCount = GroupRoleCount;
            GPD.InsigniaID = record.GroupPicture;
            GPD.MaturePublish = record.MaturePublish;
            GPD.MembershipFee = record.MembershipFee;
            GPD.MemberTitle = GroupRole[0];
            GPD.Money = 0;

            GPD.Name = record.GroupName;
            GPD.OpenEnrollment = record.OpenEnrollment;
            GPD.OwnerRole = record.OwnerRoleID;
            GPD.PowersMask = ulong.Parse(GroupRole[1]);
            GPD.ShowInList = int.Parse(Membership[2]) == 1;

            return GPD;
        }