Beispiel #1
0
 internal static void ToDirectoryPasswordProperties(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
 {
     if (!directoryObj.Contains("pwdProperties"))
     {
         throw new NotSupportedException();
     }
     else
     {
         int  value = (int)directoryObj["pwdProperties"].Value;
         bool item  = (bool)extendedData[0];
         int  bit   = PasswordPropertiesUtil.StringToBit(extendedAttribute);
         if (PasswordPropertiesUtil.IsInverseBit(bit))
         {
             item = !item;
         }
         if (!item)
         {
             value = value & ~bit;
         }
         else
         {
             value = value | bit;
         }
         directoryObj.SetValue("pwdProperties", value);
         return;
     }
 }
Beispiel #2
0
        internal static void ToExtendedPasswordProperties(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
        {
            bool flag;

            if (directoryObj.Contains(directoryAttributes[0]))
            {
                int value = (int)directoryObj[directoryAttributes[0]].Value;
                int bit   = PasswordPropertiesUtil.StringToBit(extendedAttribute);
                if (!PasswordPropertiesUtil.IsInverseBit(bit))
                {
                    flag = (value & bit) != 0;
                }
                else
                {
                    flag = (value & bit) == 0;
                }
                userObj.Add(extendedAttribute, flag);
                return;
            }
            else
            {
                return;
            }
        }