Exemple #1
0
        private bool ADResourcePropertyPreCommitFSRoutine(ADFactory <T> .DirectoryOperation operation, T instance, ADParameterSet parameters, ADObject directoryObj)
        {
            if (operation == ADFactory <T> .DirectoryOperation.Create || ADFactory <T> .DirectoryOperation.Update == operation)
            {
                bool          flag          = true;
                ADObject      aDObject      = null;
                StringBuilder stringBuilder = new StringBuilder();
                flag = flag & ADResourcePropertyFactory <T> .VerifyResourcePropertyValueType(directoryObj, base.CmdletSessionInfo, out aDObject, stringBuilder);

                if (aDObject != null && aDObject.Contains("ValueType"))
                {
                    ADClaimValueType?value = (ADClaimValueType?)(aDObject["ValueType"].Value as ADClaimValueType?);
                    flag = flag & ADCBACUtil.VerifyAndSetPossibleValues(directoryObj, value.Value, stringBuilder);
                }
                flag = flag & ADResourcePropertyFactory <T> .VerifySharesPossibleValueWithAndPossibleValueExclusiveness(directoryObj, operation, stringBuilder);

                flag = flag & ADResourcePropertyFactory <T> .VerifyIsSuggestedValuePresentAttribute(directoryObj, stringBuilder, aDObject);

                flag = flag & ADResourcePropertyFactory <T> .VerifySharesValuesWith(directoryObj, stringBuilder, aDObject, base.CmdletSessionInfo);

                if (flag)
                {
                    return(false);
                }
                else
                {
                    stringBuilder.AppendLine(StringResources.CTParameterValidationFailure);
                    throw new ADException(stringBuilder.ToString());
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        private bool ADClaimTypePreCommitFSRoutine(ADFactory <T> .DirectoryOperation operation, T instance, ADParameterSet parameters, ADObject directoryObj)
        {
            bool          classes       = true;
            StringBuilder stringBuilder = new StringBuilder();

            if (operation == ADFactory <T> .DirectoryOperation.Create || ADFactory <T> .DirectoryOperation.Update == operation)
            {
                bool switchParameterBooleanValue = parameters.GetSwitchParameterBooleanValue("SourceTransformPolicy");
                if (switchParameterBooleanValue)
                {
                    directoryObj.SetValue("msDS-ClaimSourceType", "TransformPolicy");
                    directoryObj.ForceRemove("msDS-ClaimAttributeSource");
                    directoryObj.ForceRemove("msDS-ClaimSource");
                }
                classes = classes & ADClaimTypeFactory <T> .VerifyClaimSourceAndAttributeExclusiveness(directoryObj, stringBuilder, operation);

                classes = classes & ADClaimTypeFactory <T> .VerifyClaimSourceAndPossibleValueExclusiveness(directoryObj, stringBuilder);

                classes = classes & ADClaimTypeFactory <T> .SetAndValidateClaimSourceType(directoryObj, stringBuilder);

                classes = classes & ADClaimTypeFactory <T> .VerifyRestrictValues(directoryObj, stringBuilder, base.CmdletSessionInfo, operation);

                if (directoryObj.Contains("msDS-ClaimValueType"))
                {
                    ADClaimValueType num = (ADClaimValueType)((long)Convert.ToInt32(directoryObj["msDS-ClaimValueType"].Value, CultureInfo.InvariantCulture));
                    classes = classes & ADCBACUtil.VerifyAndSetPossibleValues(directoryObj, num, stringBuilder);
                }
                classes = classes & ADClaimTypeFactory <T> .VerifyAppliesToClasses(directoryObj, stringBuilder, base.CmdletSessionInfo);

                if (classes)
                {
                    return(false);
                }
                else
                {
                    stringBuilder.AppendLine(StringResources.CTParameterValidationFailure);
                    throw new ADException(stringBuilder.ToString());
                }
            }
            else
            {
                return(false);
            }
        }