Пример #1
0
        public static void ToDirectoryGroupScope(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
        {
            ADGroupScope aDGroupScope = ADGroupScope.DomainLocal;

            if (extendedData != null)
            {
                if (extendedData.Value != null)
                {
                    ADGroupScope value = (ADGroupScope)extendedData.Value;
                    int          directoryGroupTypeValue = GroupTypeUtils.GetDirectoryGroupTypeValue(value);
                    if (!directoryObj.Contains(directoryAttributes[0]))
                    {
                        directoryObj.Add(directoryAttributes[0], directoryGroupTypeValue);
                    }
                    else
                    {
                        int num = (int)directoryObj[directoryAttributes[0]].Value;
                        if (GroupTypeUtils.TryGetExtendedGroupScopeValue(num, out aDGroupScope))
                        {
                            int directoryGroupTypeValue1 = GroupTypeUtils.GetDirectoryGroupTypeValue(aDGroupScope);
                            num = num & ~directoryGroupTypeValue1;
                        }
                        directoryObj[directoryAttributes[0]].Value = num + directoryGroupTypeValue;
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
        }
Пример #2
0
        public static IADOPathNode ToSearchGroupScope(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
        {
            ADGroupScope      aDGroupScope      = ADGroupScope.DomainLocal;
            BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;

            if (binaryADOPathNode == null)
            {
                throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
            }
            else
            {
                if (binaryADOPathNode.Operator == ADOperator.Eq || binaryADOPathNode.Operator == ADOperator.Ne)
                {
                    IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
                    if (rightNode == null)
                    {
                        throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
                    }
                    else
                    {
                        if (!Utils.TryParseEnum <ADGroupScope>(rightNode.DataObject.ToString(), out aDGroupScope))
                        {
                            object[] str = new object[2];
                            str[0] = rightNode.DataObject.ToString();
                            str[1] = extendedAttributeName;
                            throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterInvalidValue, str));
                        }
                        else
                        {
                            PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]);
                            ObjectADOPathNode   objectADOPathNode   = new ObjectADOPathNode((object)GroupTypeUtils.GetDirectoryGroupTypeValue(aDGroupScope));
                            IADOPathNode        aDOPathNode         = new BinaryADOPathNode(ADOperator.Band, propertyADOPathNode, objectADOPathNode);
                            if (binaryADOPathNode.Operator != ADOperator.Eq)
                            {
                                return(ADOPathUtil.CreateNotClause(aDOPathNode));
                            }
                            else
                            {
                                return(aDOPathNode);
                            }
                        }
                    }
                }
                else
                {
                    object[]     objArray        = new object[2];
                    ADOperator[] aDOperatorArray = new ADOperator[2];
                    aDOperatorArray[1] = ADOperator.Ne;
                    objArray[0]        = SearchConverters.ConvertOperatorListToString(aDOperatorArray);
                    objArray[1]        = extendedAttributeName;
                    throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, objArray));
                }
            }
        }