예제 #1
0
        public List <GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID)
        {
            m_log.InfoFormat("[Groups] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            List <GroupRoleMembersData> roleMemberData = new List <GroupRoleMembersData>();

            osGroup group;

            if (m_Groups.TryGetValue(groupID, out group))
            {
                foreach (osgRole role in group.Roles.Values)
                {
                    foreach (osGroupMemberInfo member in role.RoleMembers.Values)
                    {
                        GroupRoleMembersData data = new GroupRoleMembersData();
                        data.RoleID   = role.RoleID;
                        data.MemberID = member.AgentID;

                        m_log.DebugFormat("[Groups] Role {0}  :: Member {1}", role.Name, member.AgentID);

                        roleMemberData.Add(data);
                    }
                }
            }

            return(roleMemberData);
        }
예제 #2
0
        public GroupRoleMembersData ConvertGroupRoleMembersData(ExtendedGroupRoleMembersData _rm)
        {
            GroupRoleMembersData rm = new GroupRoleMembersData();

            rm.RoleID = _rm.RoleID;

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

            Util.ParseUniversalUserIdentifier(_rm.MemberID, out rm.MemberID, out url, out first, out last, out tmp);
            if (url != string.Empty)
            {
                m_UserManagement.AddUser(rm.MemberID, first, last, url);
            }

            return(rm);
        }
        public void AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, BooleanDelegate d)
        {
            if (d())
            {
                lock (m_Cache)
                {
                    // update the cached role
                    string cacheKey = "role-" + RoleID.ToString();
                    object obj;
                    if (m_Cache.TryGetValue(cacheKey, out obj))
                    {
                        GroupRolesData r = (GroupRolesData)obj;
                        r.Members++;
                    }

                    // add this agent to the list of role members
                    cacheKey = "rolemembers-" + RequestingAgentID.ToString() + "-" + GroupID.ToString();
                    if (m_Cache.TryGetValue(cacheKey, out obj))
                    {
                        try
                        {
                            // This may throw an exception, in which case the agentID is not a UUID but a full ID
                            // In that case, let's just remove the whoe things from the cache
                            UUID id = new UUID(AgentID);
                            List <ExtendedGroupRoleMembersData> xx     = (List <ExtendedGroupRoleMembersData>)obj;
                            List <GroupRoleMembersData>         rmlist = xx.ConvertAll <GroupRoleMembersData>(m_ForeignImporter.ConvertGroupRoleMembersData);
                            GroupRoleMembersData rm = new GroupRoleMembersData();
                            rm.MemberID = id;
                            rm.RoleID   = RoleID;
                            rmlist.Add(rm);
                        }
                        catch
                        {
                            m_Cache.Remove(cacheKey);
                        }
                    }

                    // Remove the cached info about this agent's roles
                    // because we don't have enough local info about the new role
                    cacheKey = "roles-" + GroupID.ToString() + "-" + AgentID.ToString();
                    if (m_Cache.Contains(cacheKey))
                    {
                        m_Cache.Remove(cacheKey);
                    }
                }
            }
        }
예제 #4
0
        public GroupRoleMembersData ConvertGroupRoleMembersData(ExtendedGroupRoleMembersData _rm)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            GroupRoleMembersData rm = new GroupRoleMembersData();

            rm.RoleID = _rm.RoleID;

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

            Util.ParseUniversalUserIdentifier(_rm.MemberID, out rm.MemberID, out url, out first, out last, out tmp);
            if (url != string.Empty)
            {
                m_UserManagement.AddUser(rm.MemberID, first, last, url);
            }

            return(rm);
        }
예제 #5
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);
        }
예제 #6
0
        public List <GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
        {
            Hashtable param = new Hashtable();

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

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

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

            if (!respData.Contains("error"))
            {
                foreach (Hashtable membership in respData.Values)
                {
                    GroupRoleMembersData data = new GroupRoleMembersData();

                    data.MemberID = new UUID((string)membership["AgentID"]);
                    data.RoleID   = new UUID((string)membership["RoleID"]);

                    members.Add(data);
                }
            }
            return(members);
        }
        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
                                                      {
                                                          RoleID = UUID.Parse(Roles[i]),
                                                          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;
        }