コード例 #1
0
        public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            string url = string.Empty, name = string.Empty;

            if (!IsLocal(GroupID, out url, out name) && url != string.Empty)
            {
                ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID);
                if (membership != null)
                {
                    GroupsServiceHGConnector c = GetConnector(url);
                    if (c != null)
                    {
                        c.RemoveAgentFromGroup(AgentUUIForOutside(AgentID), GroupID, membership.AccessToken);
                    }
                }
            }

            // remove from local service
            m_LocalGroupsConnector.RemoveAgentFromGroup(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID);
        }
コード例 #2
0
        public List <GroupRolesData> GetGroupRoles(string RequestingAgentID, UUID groupID)
        {
            string url = string.Empty, gname = string.Empty;

            if (IsLocal(groupID, out url, out gname))
            {
                return(m_LocalGroupsConnector.GetGroupRoles(AgentUUI(RequestingAgentID), groupID));
            }
            else if (!string.IsNullOrEmpty(url))
            {
                ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, groupID);
                string accessToken = string.Empty;
                if (membership != null)
                {
                    accessToken = membership.AccessToken;
                }
                else
                {
                    return(null);
                }

                GroupsServiceHGConnector c = GetConnector(url);
                if (c != null)
                {
                    return(m_CacheWrapper.GetGroupRoles(RequestingAgentID, groupID, delegate
                    {
                        return c.GetGroupRoles(AgentUUIForOutside(RequestingAgentID), groupID, accessToken);
                    }));
                }
            }

            return(new List <GroupRolesData>());
        }
コード例 #3
0
        public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
        {
            string url  = string.Empty;
            string name = string.Empty;

            reason = string.Empty;

            UUID uid = new UUID(AgentID);

            if (IsLocal(GroupID, out url, out name))
            {
                if (m_UserManagement.IsLocalGridUser(uid)) // local user
                {
                    // normal case: local group, local user
                    return(m_LocalGroupsConnector.AddAgentToGroup(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID, RoleID, token, out reason));
                }
                else // local group, foreign user
                {
                    // the user is accepting the  invitation, or joining, where the group resides
                    token = UUID.Random().ToString();
                    bool success = m_LocalGroupsConnector.AddAgentToGroup(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID, RoleID, token, out reason);

                    if (success)
                    {
                        // Here we always return true. The user has been added to the local group,
                        // independent of whether the remote operation succeeds or not
                        url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI");
                        if (url == string.Empty)
                        {
                            reason = "You don't have an accessible groups server in your home world. You membership to this group in only within this grid.";
                            return(true);
                        }

                        GroupsServiceHGConnector c = GetConnector(url);
                        if (c != null)
                        {
                            c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason);
                        }
                        return(true);
                    }
                    return(false);
                }
            }
            else if (m_UserManagement.IsLocalGridUser(uid)) // local user
            {
                // foreign group, local user. She's been added already by the HG service.
                // Let's just check
                if (m_LocalGroupsConnector.GetAgentGroupMembership(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID) != null)
                {
                    return(true);
                }
            }

            reason = "Operation not allowed outside this group's origin world";
            return(false);
        }
コード例 #4
0
        public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
                                   bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            string url = string.Empty, gname = string.Empty;

            if (IsLocal(groupID, out url, out gname))
            {
                if (m_LocalGroupsConnector.AddGroupNotice(AgentUUI(RequestingAgentID), groupID, noticeID, fromName, subject, message,
                                                          hasAttachment, attType, attName, attItemID, AgentUUI(attOwnerID)))
                {
                    // then send the notice to every grid for which there are members in this group
                    List <GroupMembersData> members = m_LocalGroupsConnector.GetGroupMembers(AgentUUI(RequestingAgentID), groupID);
                    List <string>           urls    = new List <string>();
                    foreach (GroupMembersData m in members)
                    {
                        if (!m_UserManagement.IsLocalGridUser(m.AgentID))
                        {
                            string gURL = m_UserManagement.GetUserServerURL(m.AgentID, "GroupsServerURI");
                            if (!urls.Contains(gURL))
                            {
                                urls.Add(gURL);
                            }
                        }
                    }

                    // so we have the list of urls to send the notice to
                    // this may take a long time...
                    Util.FireAndForget(delegate
                    {
                        foreach (string u in urls)
                        {
                            GroupsServiceHGConnector c = GetConnector(u);
                            if (c != null)
                            {
                                c.AddNotice(AgentUUIForOutside(RequestingAgentID), groupID, noticeID, fromName, subject, message,
                                            hasAttachment, attType, attName, attItemID, AgentUUIForOutside(attOwnerID));
                            }
                        }
                    });

                    return(true);
                }

                return(false);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
 private GroupsServiceHGConnector GetConnector(string url)
 {
     try
     {
         return(m_NetworkConnectors[url]);
     }
     catch (KeyNotFoundException)
     {
         return(m_NetworkConnectors[url] = new GroupsServiceHGConnector(url));
     }
 }
コード例 #6
0
        private GroupsServiceHGConnector GetConnector(string url)
        {
            lock (m_NetworkConnectors)
            {
                if (m_NetworkConnectors.ContainsKey(url))
                {
                    return(m_NetworkConnectors[url]);
                }

                GroupsServiceHGConnector c = new GroupsServiceHGConnector(url);
                m_NetworkConnectors[url] = c;
            }

            return(m_NetworkConnectors[url]);
        }
コード例 #7
0
        public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            string url  = string.Empty;
            string name = string.Empty;

            if (IsLocal(GroupID, out url, out name))
            {
                return(m_LocalGroupsConnector.GetGroupRecord(AgentUUI(RequestingAgentID), GroupID, GroupName));
            }
            else if (url != string.Empty)
            {
                ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID);
                string accessToken = string.Empty;
                if (membership != null)
                {
                    accessToken = membership.AccessToken;
                }
                else
                {
                    return(null);
                }

                GroupsServiceHGConnector c = GetConnector(url);
                if (c != null)
                {
                    ExtendedGroupRecord grec = m_CacheWrapper.GetGroupRecord(RequestingAgentID, GroupID, GroupName, delegate
                    {
                        return(c.GetGroupRecord(AgentUUIForOutside(RequestingAgentID), GroupID, GroupName, accessToken));
                    });

                    if (grec != null)
                    {
                        ImportForeigner(grec.FounderUUI);
                    }
                    return(grec);
                }
            }

            return(null);
        }
コード例 #8
0
        public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
        {
            string url = string.Empty, name = string.Empty;

            if (!IsLocal(GroupID, out url, out name) && url != string.Empty)
            {
                ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID);
                if (membership != null)
                {
                    GroupsServiceHGConnector c = GetConnector(url);
                    if (c != null)
                    {
                        c.RemoveAgentFromGroup(AgentUUIForOutside(AgentID), GroupID, membership.AccessToken);
                    }
                }
            }

            // remove from local service
            m_LocalGroupsConnector.RemoveAgentFromGroup(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID);
        }
コード例 #9
0
        private GroupsServiceHGConnector GetConnector(string url)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            lock (m_NetworkConnectors)
            {
                if (m_NetworkConnectors.ContainsKey(url))
                {
                    return(m_NetworkConnectors[url]);
                }

                GroupsServiceHGConnector c = new GroupsServiceHGConnector(url);
                m_NetworkConnectors[url] = c;
            }

            return(m_NetworkConnectors[url]);
        }
コード例 #10
0
        private GroupsServiceHGConnector GetConnector(string url)
        {
            m_RwLock.AcquireReaderLock(-1);
            try
            {
                if (m_NetworkConnectors.ContainsKey(url))
                {
                    return(m_NetworkConnectors[url]);
                }

                LockCookie lc = m_RwLock.UpgradeToWriterLock(-1);
                GroupsServiceHGConnector c = new GroupsServiceHGConnector(url);
                m_NetworkConnectors[url] = c;
                m_RwLock.DowngradeFromWriterLock(ref lc);
                return(c);
            }
            finally
            {
                m_RwLock.ReleaseReaderLock();
            }
        }
コード例 #11
0
        public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
        {
            string url  = string.Empty;
            string name = string.Empty;

            if (IsLocal(GroupID, out url, out name))
            {
                return(m_LocalGroupsConnector.GetGroupRecord(AgentUUI(RequestingAgentID), GroupID, GroupName));
            }
            else if (url != string.Empty)
            {
                ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID);
                string accessToken = string.Empty;
                if (membership != null)
                {
                    accessToken = membership.AccessToken;
                }
                else
                {
                    return(null);
                }

                GroupsServiceHGConnector c = GetConnector(url);
                if (c != null)
                {
                    ExtendedGroupRecord grec = m_CacheWrapper.GetGroupRecord(RequestingAgentID, GroupID, GroupName, delegate
                    {
                        return(c.GetGroupRecord(AgentUUIForOutside(RequestingAgentID), GroupID, GroupName, accessToken));
                    });

                    if (grec != null)
                    {
                        ImportForeigner(grec.FounderUUI);
                    }
                    return(grec);
                }
            }

            return(null);
        }
コード例 #12
0
        public List <GroupRoleMembersData> GetGroupRoleMembers(string RequestingAgentID, UUID groupID)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            string url = string.Empty, gname = string.Empty;

            if (IsLocal(groupID, out url, out gname))
            {
                return(m_LocalGroupsConnector.GetGroupRoleMembers(AgentUUI(RequestingAgentID), groupID));
            }
            else if (!string.IsNullOrEmpty(url))
            {
                ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, groupID);
                string accessToken = string.Empty;
                if (membership != null)
                {
                    accessToken = membership.AccessToken;
                }
                else
                {
                    return(null);
                }

                GroupsServiceHGConnector c = GetConnector(url);
                if (c != null)
                {
                    return(m_CacheWrapper.GetGroupRoleMembers(RequestingAgentID, groupID, delegate
                    {
                        return c.GetGroupRoleMembers(AgentUUIForOutside(RequestingAgentID), groupID, accessToken);
                    }));
                }
            }

            return(new List <GroupRoleMembersData>());
        }
コード例 #13
0
 private GroupsServiceHGConnector GetConnector(string url)
 {
     try
     {
         return m_NetworkConnectors[url];
     }
     catch(KeyNotFoundException)
     {
         return m_NetworkConnectors[url] = new GroupsServiceHGConnector(url);
     }
 }
コード例 #14
0
        private GroupsServiceHGConnector GetConnector(string url)
        {
            lock (m_NetworkConnectors)
            {
                if (m_NetworkConnectors.ContainsKey(url))
                    return m_NetworkConnectors[url];

                GroupsServiceHGConnector c = new GroupsServiceHGConnector(url);
                m_NetworkConnectors[url] = c;
            }

            return m_NetworkConnectors[url];
        }
コード例 #15
0
        private GroupsServiceHGConnector GetConnector(string url)
        {
			if (m_log.IsDebugEnabled) {
				m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name);
			}

            lock (m_NetworkConnectors)
            {
                if (m_NetworkConnectors.ContainsKey(url))
                    return m_NetworkConnectors[url];

                GroupsServiceHGConnector c = new GroupsServiceHGConnector(url);
                m_NetworkConnectors[url] = c;
            }

            return m_NetworkConnectors[url];
        }