Esempio n. 1
0
        protected void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string accessToken)
        {
            // Check if it's already there
            MembershipData data = m_Database.RetrieveMember(GroupID, AgentID);
            if (data != null)
                return;

            // Add the membership
            data = new MembershipData();
            data.PrincipalID = AgentID;
            data.GroupID = GroupID;
            data.Data = new Dictionary<string, string>();
            data.Data["SelectedRoleID"] = RoleID.ToString();
            data.Data["Contribution"] = "0";
            data.Data["ListInProfile"] = "1";
            data.Data["AcceptNotices"] = "1";
            data.Data["AccessToken"] = accessToken;

            m_Database.StoreMember(data);

            // Add principal to everyone role
            _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, UUID.Zero);

            // Add principal to role, if different from everyone role
            if (RoleID != UUID.Zero)
                _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);

            // Make thit this active group
            PrincipalData pdata = new PrincipalData();
            pdata.PrincipalID = AgentID;
            pdata.ActiveGroupID = GroupID;
            m_Database.StorePrincipal(pdata);

        }
Esempio n. 2
0
        public ExtendedGroupMembershipData SetAgentActiveGroup(string RequestingAgentID, string AgentID, UUID GroupID)
        {
            // TODO: check perms
            PrincipalData principal = new PrincipalData();
            principal.PrincipalID = AgentID;
            principal.ActiveGroupID = GroupID;
            m_Database.StorePrincipal(principal);

            return GetAgentGroupMembership(RequestingAgentID, AgentID, GroupID);
        }