Example #1
0
        /// <summary>
        /// Write the XML for the members
        /// </summary>
        /// <param name="xmlWriter"></param>
        internal void WriteGroupAsXml(XmlWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("GroupMembership");
            xmlWriter.WriteAttributeString("name", this.GroupName);

            //Group instructions for Grant License
            xmlWriter.WriteAttributeString(
                ProvisioningGroup.XmlAttribute_GrantLicenseMode,
                ProvisioningGroup.GenerateGrantLicenseModeAttributeText(this.GrantLicenseInstructions));

            //If there is a role specified, then write it into an attribute
            //Unless the Grant License Instructions are "none" or "ignore" in these cases, the role does note matter
            if ((!string.IsNullOrWhiteSpace(this.GrantLicenseRole)) &&
                (this.GrantLicenseInstructions != ProvisioningGroup.GrantLicenseMode.Ignore) &&
                (this.GrantLicenseInstructions != ProvisioningGroup.GrantLicenseMode.None)
                )
            {
                xmlWriter.WriteAttributeString(
                    ProvisioningGroup.XmlAttribute_GrantLicenseMinimumSiteRole,
                    this.GrantLicenseRole);
            }


            //For all the users mapped to this group, write them out
            foreach (var thisUserInfo in _usersSet.Values)
            {
                xmlWriter.WriteStartElement("GroupMember");
                xmlWriter.WriteAttributeString("name", thisUserInfo);
                xmlWriter.WriteEndElement();
            }
            xmlWriter.WriteEndElement();
        }