示例#1
0
        public bool IsPlayerAMemberOf(UUID groupId, UserAccount ua)
        {
            if (!WaterWarsConstants.ENABLE_GROUPS)
            {
                return(true);
            }

            GroupMembershipData groupData = m_groupsModule.GetMembershipData(groupId, ua.PrincipalID);
            bool foundPlayer = groupData != null;

            if (foundPlayer)
            {
                m_log.InfoFormat(
                    "[WATER WARS]: Found player {0} in group {1} {2}",
                    ua.Name, groupData.GroupName, groupData.GroupID);
            }

            return(foundPlayer);
        }
        private bool CanJoinGroupIM(UUID agentID, UUID groupID)
        {
            GroupMembershipData data = m_groupsModule.GetMembershipData(groupID, agentID);

            if (data == null)
            {
                return(false);
            }
            return((data.GroupPowers & (ulong)GroupPowers.JoinChat) == (ulong)GroupPowers.JoinChat);
        }
示例#3
0
        private bool CheckEstateGroups(EstateSettings ES, AgentCircuitData agent)
        {
            IGroupsModule gm = m_scene.RequestModuleInterface <IGroupsModule>();

            if (gm != null && ES.EstateGroups.Count > 0)
            {
                GroupMembershipData[] gmds = gm.GetMembershipData(agent.AgentID);
                return(gmds.Any(gmd => ES.EstateGroups.Contains(gmd.GroupID)));
            }
            return(false);
        }
示例#4
0
        /**
         * @brief Allow any member of group given by config SetParcelMusicURLGroup to set music URL.
         *        Code modelled after llSetParcelMusicURL().
         * @param newurl = new URL to set (or "" to leave it alone)
         * @returns previous URL string
         */
        public string xmrSetParcelMusicURLGroup(string newurl)
        {
            string groupname = m_ScriptEngine.Config.GetString("SetParcelMusicURLGroup", "");

            if (groupname == "")
            {
                throw new ApplicationException("no SetParcelMusicURLGroup config param set");
            }

            IGroupsModule igm = World.RequestModuleInterface <IGroupsModule> ();

            if (igm == null)
            {
                throw new ApplicationException("no GroupsModule loaded");
            }

            GroupRecord grouprec = igm.GetGroupRecord(groupname);

            if (grouprec == null)
            {
                throw new ApplicationException("no such group " + groupname);
            }

            GroupMembershipData gmd = igm.GetMembershipData(grouprec.GroupID, m_host.OwnerID);

            if (gmd == null)
            {
                throw new ApplicationException("not a member of group " + groupname);
            }

            ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);

            if (land == null)
            {
                throw new ApplicationException("no land at " + m_host.AbsolutePosition.ToString());
            }
            string oldurl = land.GetMusicUrl();

            if (oldurl == null)
            {
                oldurl = "";
            }
            if ((newurl != null) && (newurl != ""))
            {
                land.SetMusicUrl(newurl);
            }
            return(oldurl);
        }
示例#5
0
        public bool HasGroupAccess(UUID avatar)
        {
            if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)
            {
                ScenePresence sp;
                if (!m_scene.TryGetScenePresence(avatar, out sp))
                {
                    bool isMember;
                    if (m_groupMemberCache.TryGetValue(avatar, out isMember))
                    {
                        m_groupMemberCache.Update(avatar, isMember, m_groupMemberCacheTimeout);
                        return(isMember);
                    }

                    IGroupsModule groupsModule = m_scene.RequestModuleInterface <IGroupsModule>();
                    if (groupsModule == null)
                    {
                        return(false);
                    }

                    GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar);
                    if (membership == null || membership.Length == 0)
                    {
                        m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout);
                        return(false);
                    }

                    foreach (GroupMembershipData d in membership)
                    {
                        if (d.GroupID == LandData.GroupID)
                        {
                            m_groupMemberCache.Add(avatar, true, m_groupMemberCacheTimeout);
                            return(true);
                        }
                    }
                    m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout);
                    return(false);
                }

                return(sp.ControllingClient.IsGroupMember(LandData.GroupID));
            }
            return(false);
        }
        //TODO: Flagged to optimize
        public void DirPeopleQuery(IClientAPI remoteClient, UUID queryID,
                                   string queryText, uint queryFlags, int queryStart)
        {
            //Find the user accounts
            List <UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts(remoteClient.AllScopeIDs,
                                                                                         queryText);
            List <DirPeopleReplyData> ReturnValues =
                new List <DirPeopleReplyData>();

            foreach (UserAccount item in accounts)
            {
                //This is really bad, we should not be searching for all of these people again in the Profile service
                IUserProfileInfo UserProfile = ProfileFrontend.GetUserProfile(item.PrincipalID);
                if (UserProfile == null)
                {
                    DirPeopleReplyData person = new DirPeopleReplyData
                    {
                        agentID   = item.PrincipalID,
                        firstName = item.FirstName,
                        lastName  = item.LastName
                    };
                    if (GroupsModule == null)
                    {
                        person.group = "";
                    }
                    else
                    {
                        person.group = "";
                        GroupMembershipData[] memberships = GroupsModule.GetMembershipData(item.PrincipalID);
                        foreach (GroupMembershipData membership in memberships.Where(membership => membership.Active))
                        {
                            person.group = membership.GroupName;
                        }
                    }
                    //Then we have to pull the GUI to see if the user is online or not
                    UserInfo Pinfo =
                        m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(item.PrincipalID.ToString());
                    if (Pinfo != null && Pinfo.IsOnline) //If it is null, they are offline
                    {
                        person.online = true;
                    }
                    person.reputation = 0;
                    ReturnValues.Add(person);
                }
                else if (UserProfile.AllowPublish) //Check whether they want to be in search or not
                {
                    DirPeopleReplyData person = new DirPeopleReplyData
                    {
                        agentID   = item.PrincipalID,
                        firstName = item.FirstName,
                        lastName  = item.LastName
                    };
                    if (GroupsModule == null)
                    {
                        person.group = "";
                    }
                    else
                    {
                        person.group = "";
                        //Check what group they have set
                        GroupMembershipData[] memberships = GroupsModule.GetMembershipData(item.PrincipalID);
                        foreach (GroupMembershipData membership in memberships.Where(membership => membership.Active))
                        {
                            person.group = membership.GroupName;
                        }
                    }
                    //Then we have to pull the GUI to see if the user is online or not
                    UserInfo Pinfo =
                        m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(item.PrincipalID.ToString());
                    if (Pinfo != null && Pinfo.IsOnline)
                    {
                        person.online = true;
                    }
                    person.reputation = 0;
                    ReturnValues.Add(person);
                }
            }

#if (!ISWIN)
            SplitPackets <DirPeopleReplyData>(ReturnValues, delegate(DirPeopleReplyData[] data)
            {
                remoteClient.SendDirPeopleReply(queryID, data);
            });
#else
            SplitPackets(ReturnValues,
                         data => remoteClient.SendDirPeopleReply(queryID, data));
#endif
        }