Exemplo n.º 1
0
        public static void ToDirectoryGroupCategory(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
        {
            ADGroupCategory aDGroupCategory = ADGroupCategory.Distribution;

            if (extendedData != null)
            {
                if (extendedData.Value != null)
                {
                    ADGroupCategory value = (ADGroupCategory)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.TryGetExtendedGroupCategoryValue(num, out aDGroupCategory))
                        {
                            int directoryGroupTypeValue1 = GroupTypeUtils.GetDirectoryGroupTypeValue(aDGroupCategory);
                            num = num & ~directoryGroupTypeValue1;
                        }
                        directoryObj[directoryAttributes[0]].Value = num + directoryGroupTypeValue;
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
        }
Exemplo n.º 2
0
		public static int GetDirectoryGroupTypeValue(ADGroupCategory groupCategory)
		{
			ADGroupCategory aDGroupCategory = groupCategory;
			if (aDGroupCategory != ADGroupCategory.Security)
			{
				return 0;
			}
			else
			{
				return -2147483648;
			}
		}
Exemplo n.º 3
0
        public static int GetDirectoryGroupTypeValue(ADGroupCategory groupCategory)
        {
            ADGroupCategory aDGroupCategory = groupCategory;

            if (aDGroupCategory != ADGroupCategory.Security)
            {
                return(0);
            }
            else
            {
                return(-2147483648);
            }
        }
Exemplo n.º 4
0
 public static bool TryGetExtendedGroupCategoryValue(int ldapgroupTypeValue, out ADGroupCategory groupCategory)
 {
     if ((ldapgroupTypeValue & -2147483648) != -2147483648)
     {
         groupCategory = ADGroupCategory.Distribution;
         return(true);
     }
     else
     {
         groupCategory = ADGroupCategory.Security;
         return(true);
     }
 }
Exemplo n.º 5
0
		public static bool TryGetExtendedGroupCategoryValue(int ldapgroupTypeValue, out ADGroupCategory groupCategory)
		{
			if ((ldapgroupTypeValue & -2147483648) != -2147483648)
			{
				groupCategory = ADGroupCategory.Distribution;
				return true;
			}
			else
			{
				groupCategory = ADGroupCategory.Security;
				return true;
			}
		}
Exemplo n.º 6
0
        public static IADOPathNode ToSearchGroupCategory(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
        {
            ADGroupCategory   aDGroupCategory = ADGroupCategory.Distribution;
            IADOPathNode      binaryADOPathNode;
            BinaryADOPathNode binaryADOPathNode1 = filterClause as BinaryADOPathNode;

            if (binaryADOPathNode1 == null)
            {
                throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
            }
            else
            {
                if (binaryADOPathNode1.Operator == ADOperator.Eq || binaryADOPathNode1.Operator == ADOperator.Ne)
                {
                    IDataNode rightNode = binaryADOPathNode1.RightNode as IDataNode;
                    if (rightNode == null)
                    {
                        throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
                    }
                    else
                    {
                        PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]);
                        ObjectADOPathNode   objectADOPathNode   = new ObjectADOPathNode(null);
                        if (!Utils.TryParseEnum <ADGroupCategory>(rightNode.DataObject.ToString(), out aDGroupCategory))
                        {
                            object[] str = new object[2];
                            str[0] = rightNode.DataObject.ToString();
                            str[1] = extendedAttributeName;
                            throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterInvalidValue, str));
                        }
                        else
                        {
                            objectADOPathNode.DataObject = -2147483648;
                            if (aDGroupCategory != ADGroupCategory.Security)
                            {
                                binaryADOPathNode = ADOPathUtil.CreateNotClause(new BinaryADOPathNode(ADOperator.Band, propertyADOPathNode, objectADOPathNode));
                            }
                            else
                            {
                                binaryADOPathNode = new BinaryADOPathNode(ADOperator.Band, propertyADOPathNode, objectADOPathNode);
                            }
                            if (binaryADOPathNode1.Operator != ADOperator.Eq)
                            {
                                return(ADOPathUtil.CreateNotClause(binaryADOPathNode));
                            }
                            else
                            {
                                return(binaryADOPathNode);
                            }
                        }
                    }
                }
                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));
                }
            }
        }