コード例 #1
0
        private static bool VerifySharesValuesWith(ADObject directoryObj, StringBuilder errorBuffer, ADObject resourcePropertyValueTypeObj, CmdletSessionInfo cmdletSessionInfo)
        {
            bool flag = false;

            if (directoryObj.Contains("msDS-ClaimSharesPossibleValuesWith") && resourcePropertyValueTypeObj != null)
            {
                ADClaimTypeFactory <ADClaimType> aDClaimTypeFactory = new ADClaimTypeFactory <ADClaimType>();
                aDClaimTypeFactory.SetCmdletSessionInfo(cmdletSessionInfo);
                ADClaimType aDClaimType = new ADClaimType();
                aDClaimType.Identity = directoryObj["msDS-ClaimSharesPossibleValuesWith"].Value as string;
                string str = ADPathModule.MakePath(cmdletSessionInfo.ADRootDSE.ConfigurationNamingContext, "CN=Claims Configuration,CN=Services,", ADPathFormat.X500);
                str = ADPathModule.MakePath(str, "CN=Claim Types,", ADPathFormat.X500);
                ADObject extendedObjectFromIdentity = aDClaimTypeFactory.GetExtendedObjectFromIdentity(aDClaimType, str);
                if (!extendedObjectFromIdentity.Contains("CompatibleResourceTypes") || extendedObjectFromIdentity["CompatibleResourceTypes"].Value == null)
                {
                    flag = true;
                    errorBuffer.AppendLine(StringResources.ResourcePropertySharesValueWithValueTypeError);
                }
                else
                {
                    List <string> value = extendedObjectFromIdentity["CompatibleResourceTypes"].Value as List <string>;
                    if (!value.Contains(resourcePropertyValueTypeObj.Name))
                    {
                        flag = true;
                        errorBuffer.AppendLine(StringResources.ResourcePropertySharesValueWithValueTypeError);
                    }
                }
            }
            return(!flag);
        }
コード例 #2
0
        internal static string[] GetClaimTypeName(ADClaimType[] claims, CmdletSessionInfo cmdletSessionInfo, string extendedAttribute)
        {
            List <string> strs = new List <string>();

            ADClaimType[] aDClaimTypeArray = claims;
            for (int i = 0; i < (int)aDClaimTypeArray.Length; i++)
            {
                ADClaimType aDClaimType = aDClaimTypeArray[i];
                string      str         = ADPathModule.MakePath(cmdletSessionInfo.ADRootDSE.ConfigurationNamingContext, "CN=Claims Configuration,CN=Services,", ADPathFormat.X500);
                str = ADPathModule.MakePath(str, "CN=Claim Types,", ADPathFormat.X500);
                string attributeValueFromObjectName = (string)AttributeConverters.GetAttributeValueFromObjectName <ADClaimTypeFactory <ADClaimType>, ADClaimType>(aDClaimType, str, "Name", extendedAttribute, cmdletSessionInfo);
                strs.Add(attributeValueFromObjectName);
            }
            return(strs.ToArray());
        }