示例#1
0
        internal static void ToPolicyRuleStringFromRuleXml(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
        {
            if (!directoryObj.Contains(directoryAttributes[0]))
            {
                userObj.Add(extendedAttribute, new ADPropertyValueCollection());
            }
            else
            {
                try
                {
                    string str = ADClaimTransformPolicyFactory <T> .ParseRules(directoryObj[directoryAttributes[0]].Value as string);

                    ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection(str);
                    userObj.Add(extendedAttribute, aDPropertyValueCollection);
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    if (exception as ADException != null || exception as XmlException != null)
                    {
                        object[] value = new object[3];
                        value[0] = directoryObj["distinguishedName"].Value;
                        value[1] = exception.Message;
                        value[2] = directoryObj[directoryAttributes[0]].Value;
                        cmdletSessionInfo.CmdletMessageWriter.WriteWarningBuffered(string.Format(CultureInfo.CurrentCulture, StringResources.ClaimPolicyXmlWarning, value));
                        userObj.Add(extendedAttribute, new ADPropertyValueCollection());
                    }
                    else
                    {
                        throw exception;
                    }
                }
            }
        }