Example #1
0
 internal static void ToCompatibleResourceTypes(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
 {
     if (!directoryObj.Contains("msDS-ClaimValueType") || !directoryObj.Contains("msDS-ClaimIsValueSpaceRestricted"))
     {
         ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection(null);
         userObj.Add(extendedAttribute, aDPropertyValueCollection);
         return;
     }
     else
     {
         long           value            = (long)directoryObj["msDS-ClaimValueType"].Value;
         bool           flag             = directoryObj.Contains("msDS-ClaimPossibleValues");
         IADOPathNode   aDOPathNode      = ADOPathUtil.CreateFilterClause(ADOperator.Eq, "msDS-ClaimValueType", value);
         IADOPathNode   aDOPathNode1     = ADOPathUtil.CreateFilterClause(ADOperator.Eq, "msDS-IsPossibleValuesPresent", flag);
         IADOPathNode[] aDOPathNodeArray = new IADOPathNode[2];
         aDOPathNodeArray[0] = aDOPathNode;
         aDOPathNodeArray[1] = aDOPathNode1;
         IADOPathNode aDOPathNode2 = ADOPathUtil.CreateAndClause(aDOPathNodeArray);
         ADResourcePropertyValueTypeFactory <ADResourcePropertyValueType> aDResourcePropertyValueTypeFactory = new ADResourcePropertyValueTypeFactory <ADResourcePropertyValueType>();
         aDResourcePropertyValueTypeFactory.SetCmdletSessionInfo(cmdletSessionInfo);
         string str       = ADPathModule.MakePath(cmdletSessionInfo.ADRootDSE.ConfigurationNamingContext, "CN=Value Types,CN=Claims Configuration,CN=Services,", ADPathFormat.X500);
         int?   nullable  = null;
         int?   nullable1 = null;
         IEnumerable <ADResourcePropertyValueType> extendedObjectFromFilter = aDResourcePropertyValueTypeFactory.GetExtendedObjectFromFilter(aDOPathNode2, str, ADSearchScope.OneLevel, null, nullable, nullable1, false);
         List <string> strs = new List <string>();
         foreach (ADResourcePropertyValueType aDResourcePropertyValueType in extendedObjectFromFilter)
         {
             strs.Add(aDResourcePropertyValueType.Name);
         }
         userObj.Add(extendedAttribute, new ADPropertyValueCollection(strs));
         return;
     }
 }
Example #2
0
        private static bool VerifyResourcePropertyValueType(ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo, out ADObject resourcePropertyValueTypeObj, StringBuilder errorBuffer)
        {
            bool flag = false;

            resourcePropertyValueTypeObj = null;
            if (directoryObj.Contains("msDS-ValueTypeReference"))
            {
                string value = directoryObj["msDS-ValueTypeReference"].Value as string;
                ADResourcePropertyValueTypeFactory <ADResourcePropertyValueType> aDResourcePropertyValueTypeFactory = new ADResourcePropertyValueTypeFactory <ADResourcePropertyValueType>();
                aDResourcePropertyValueTypeFactory.SetCmdletSessionInfo(cmdletSessionInfo);
                ADResourcePropertyValueType aDResourcePropertyValueType = new ADResourcePropertyValueType();
                aDResourcePropertyValueType.Identity = value;
                string str = ADPathModule.MakePath(cmdletSessionInfo.ADRootDSE.ConfigurationNamingContext, "CN=Value Types,CN=Claims Configuration,CN=Services,", ADPathFormat.X500);
                resourcePropertyValueTypeObj = aDResourcePropertyValueTypeFactory.GetExtendedObjectFromIdentity(aDResourcePropertyValueType, str);
            }
            else
            {
                flag = true;
                errorBuffer.AppendLine(StringResources.RCTNoResourcePropertyValueTypeError);
            }
            return(!flag);
        }