public Schema GetMmsSchema() { Schema schema = Schema.Create(); foreach (AcmaSchemaObjectClass schemaObject in ActiveConfig.DB.ObjectClassesBindingList) { SchemaType schemaType = SchemaType.Create(schemaObject.Name, true); schemaType.Attributes.Add(SchemaAttribute.CreateAnchorAttribute("objectId", AttributeType.String, AttributeOperation.ImportOnly)); foreach (AcmaSchemaAttribute attribute in schemaObject.Attributes.Where(t => t.Name != "objectId")) { if (attribute.Operation == AcmaAttributeOperation.AcmaInternal || attribute.Operation == AcmaAttributeOperation.AcmaInternalTemp) { continue; } if (attribute.IsMultivalued) { schemaType.Attributes.Add(SchemaAttribute.CreateMultiValuedAttribute(attribute.Name, attribute.MmsType, attribute.MmsOperationType)); } else { schemaType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute(attribute.Name, attribute.MmsType, attribute.MmsOperationType)); } } schema.Types.Add(schemaType); } return(schema); }
public static DbObject FromType(Type modelType) { string schema = "dbo"; string name = modelType.Name; TableAttribute tblAttr = modelType.GetCustomAttribute <TableAttribute>(); if (tblAttr != null) { if (!string.IsNullOrEmpty(tblAttr.Schema)) { schema = tblAttr.Schema; } name = tblAttr.Name; } SchemaAttribute schemaAttr = modelType.GetCustomAttribute <SchemaAttribute>(); if (schemaAttr != null) { schema = schemaAttr.Schema; } return(new DbObject(schema, name) { ModelType = modelType }); }
private static SchemaType GetSchemaTypeGroup(IOktaClient client) { SchemaType mmsType = SchemaType.Create("group", true); SchemaAttribute mmsAttribute = SchemaAttribute.CreateAnchorAttribute("id", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("created", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("lastUpdated", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("lastMembershipUpdated", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("type", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("name", AttributeType.String, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("description", AttributeType.String, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateMultiValuedAttribute("member", AttributeType.Reference, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); return(mmsType); }
// Get Schema public Schema GetSchema(KeyedCollection <string, ConfigParameter> _configParameters) { utils.Logger(TraceEventType.Information, ConstDefinition.ID0100_START_GETSCHEMA, ConstDefinition.MSG0100_START_GETSCHEMA); try { SchemaType personType = SchemaType.Create("Person", false); personType.Attributes.Add(SchemaAttribute.CreateAnchorAttribute("Username", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("Alias", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("Email", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("LastName", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("EmailEncodingKey", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("LanguageLocaleKey", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("LocaleSidKey", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("ProfileId", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("TimeZoneSidKey", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("UserPermissionsOfflineUser", AttributeType.Boolean)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("UserPermissionsMarketingUser", AttributeType.Boolean)); Schema schema = Schema.Create(); schema.Types.Add(personType); return(schema); } catch (Exception ex) { utils.Logger(TraceEventType.Error, ConstDefinition.ID0199_ERROR_GETSCHEMA, ConstDefinition.MSG0199_ERROR_GETSCHEMA + ex.Message); throw new ExtensibleExtensionException(ConstDefinition.MSG0199_ERROR_GETSCHEMA + ex.Message); } }
public object GetObjectToSerialize(object obj, Type targetType) { ValueChange valueChange = obj as ValueChange; if (valueChange != null) { return(new ValueChangeSerializable(valueChange)); } AttributeChange attributeChange = obj as AttributeChange; if (attributeChange != null) { return(new AttributeChangeSerializable(attributeChange)); } CSEntryChange csentry = obj as CSEntryChange; if (csentry != null) { return(new CSEntryChangeSerializable(csentry)); } CSEntryChangeResult csentryresult = obj as CSEntryChangeResult; if (csentryresult != null) { return(new CSEntryChangeResultSerializable(csentryresult)); } AnchorAttribute anchor = obj as AnchorAttribute; if (anchor != null) { return(new AnchorAttributeSerializable(anchor)); } SchemaAttribute schemaAttribute = obj as SchemaAttribute; if (schemaAttribute != null) { return(new SchemaAttributeSerializable(schemaAttribute)); } SchemaType schemaType = obj as SchemaType; if (schemaType != null) { return(new SchemaTypeSerializable(schemaType)); } Schema schema = obj as Schema; if (schema != null) { return(new SchemaSerializable(schema)); } return(obj); }
private static SchemaType GetSchemaTypePublicChannel() { SchemaType mmsType = SchemaType.Create("publicChannel", true); SchemaAttribute mmsAttribute = SchemaAttribute.CreateAnchorAttribute("id", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateAnchorAttribute("teamid", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("description", AttributeType.String, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("displayName", AttributeType.String, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("email", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("webUrl", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("team", AttributeType.Reference, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("isFavoriteByDefault", AttributeType.Boolean, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); return(mmsType); }
public static void Schema_PropertyGet_MatchesCtorArgument() { const string schemaValue = "test"; var schemaAttr = new SchemaAttribute(schemaValue); Assert.That(schemaAttr.Schema, Is.EqualTo(schemaValue)); }
internal void SetObject(SchemaAttribute attribute) { this.DataType = attribute.DataType; this.Name = attribute.Name; this.AllowedAttributeOperation = attribute.AllowedAttributeOperation; this.IsAnchor = attribute.IsAnchor; this.IsMultiValued = attribute.IsMultiValued; }
private static IEnumerable <SchemaAttribute> GetAttributesFromDefinition(IDictionary <string, object> definitions, string definitionName) { if (!definitions.ContainsKey(definitionName)) { logger.Error($"The definition for type {definitionName} was not found in the response"); yield break; } if (!(definitions[definitionName] is IDictionary <string, object> definitionObject)) { logger.Info($"The definition for type {definitionName} was null"); yield break; } if (!definitionObject.ContainsKey("properties")) { logger.Error($"The definition for type {definitionName} was did not contain any properties"); yield break; } if (!(definitionObject["properties"] is IDictionary <string, object> properties)) { logger.Info($"The properties definition for {definitionName} were missing"); yield break; } foreach (KeyValuePair <string, object> property in properties) { string name = property.Key; if (!(property.Value is IDictionary <string, object> values)) { logger.Warn($"Missing value set for property {name}"); continue; } AttributeOperation operation = SchemaProvider.GetAttributeOperationFromMutability(values["mutability"].ToString()); bool ismultivalued = SchemaProvider.IsMultivalued(values); AttributeType type = SchemaProvider.GetTypeForAttribute(values, ismultivalued); if (name == "managerId") { type = AttributeType.Reference; } logger.Info($"Got attribute {name} of type {type} and is mv {ismultivalued}"); if (ismultivalued) { yield return(SchemaAttribute.CreateMultiValuedAttribute(name, type, operation)); } else { yield return(SchemaAttribute.CreateSingleValuedAttribute(name, type, operation)); } } }
private static IJsonSchema _GetPropertySchema(TypeInfo typeInfo, SchemaAttribute attribute) { var propertyName = attribute.Source; var property = typeInfo.GetAllProperties() .FirstOrDefault(p => typeof(IJsonSchema).GetTypeInfo().IsAssignableFrom(p.PropertyType.GetTypeInfo()) && p.GetMethod.IsStatic && p.Name == propertyName); var schema = (IJsonSchema)property?.GetMethod.Invoke(null, new object[] { }); return(schema); }
public static string GetName(this Type type) { string fqTableName = string.Empty; SchemaAttribute schemaAttribute = type.GetCustomAttribute <SchemaAttribute>(); fqTableName = schemaAttribute == null ? $"[{type.Name}]" : $"[{schemaAttribute.Name}].[{type.Name}]"; return(fqTableName); }
private static string GetSchemaName(Type type) { SchemaAttribute schemaAttr = type.GetCustomAttribute <SchemaAttribute>(true); if (schemaAttr != null) { return(schemaAttr.Name); } return(string.Empty); }
private static SchemaType GetCustomerType() { SchemaType customerType = SchemaType.Create("customer", false); customerType.Attributes.Add(SchemaAttribute.CreateAnchorAttribute("objectID", AttributeType.String)); customerType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("companyName", AttributeType.String)); customerType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("domain", AttributeType.String)); customerType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("tenantId", AttributeType.String)); return(customerType); }
public IEnumerable <SchemaAttribute> GetSchemaAttributes() { if (this.IsMultivalued) { yield return(SchemaAttribute.CreateMultiValuedAttribute(this.AttributeName, this.AttributeType, this.Operation)); } else { yield return(SchemaAttribute.CreateSingleValuedAttribute(this.AttributeName, this.AttributeType, this.Operation)); } }
internal BackpackAssetDescriptionAttribute( SchemaOverviewAttribute attributeOverview, SchemaAttribute attribute) : this(attributeOverview) { Value = attribute?.AttributeValue; NumericValue = !string.IsNullOrWhiteSpace(attribute?.AttributeValue) && decimal.TryParse(attribute.AttributeValue, out var result) ? result : (decimal?)null; AccountInfo = null; }
internal static string GetSchemaName(MemberInfo type) { string name = string.Empty; if (Attribute.IsDefined(type, typeof(SchemaAttribute)) && (type.GetCustomAttribute(typeof(SchemaAttribute)) as SchemaAttribute) != null) { SchemaAttribute attribute = type.GetCustomAttribute(typeof(SchemaAttribute)) as SchemaAttribute; name = attribute?.Name; } return(name); }
public static SchemaAttributeResponse ToDomain(this SchemaAttribute attr) { if (attr == null) { throw new ArgumentNullException(nameof(attr)); } var result = new SchemaAttributeResponse(); SetData(result, attr); return(result); }
private static IJsonSchema _GetFileSchema(SchemaAttribute attribute) { var uri = attribute.Source; if (!Uri.TryCreate(uri, UriKind.Absolute, out _)) { uri = System.IO.Path.Combine(Directory.GetCurrentDirectory(), uri); } var schema = JsonSchemaRegistry.Get(uri); return(schema); }
private string GetEntitySchemaName(Type type) { string name = string.Empty; if (Attribute.IsDefined(type, typeof(SchemaAttribute)) && (type.GetCustomAttribute(typeof(SchemaAttribute)) as SchemaAttribute) != null) { SchemaAttribute attribute = type.GetCustomAttribute(typeof(SchemaAttribute)) as SchemaAttribute; name = attribute.Name; } return(name); }
public Schema GetSchema(System.Collections.ObjectModel.KeyedCollection <string, ConfigParameter> configParameters) { Schema schema = Schema.Create(); Microsoft.MetadirectoryServices.SchemaType type; //we want to fetch schema for all MAs, that way configuration wont get lost if an item is //unselected, and the checkbox can become simply an activate/deactivate switch DataSet mas = FIMConfiguration.GetManagementAgents(null); foreach (DataRow ma in mas.Tables["Config"].Rows) { string maName = ma["ma_name"].ToString(); string maType = ma["ma_type"].ToString(); string maList = ma["ma_listname"].ToString(); if (maType.Equals("FIM", StringComparison.InvariantCultureIgnoreCase) || maList.Equals("Provisioning Management Agent (Insight)", StringComparison.InvariantCultureIgnoreCase)) { continue; } //create a new schema type based on the ma type = Microsoft.MetadirectoryServices.SchemaType.Create(maName, false); //add a generic Anchor Attribute to allow user to add flows for the actual anchor type.Attributes.Add(SchemaAttribute.CreateAnchorAttribute("Anchor", AttributeType.String)); //we must preface each attribute with the MA name to make it unique across the schema allowing for //an attribute in two different MAs with different data types, etc. //our data will come back as XML data, we will need to parse it for what we need XmlDocument xmldoc = FIMConfiguration.GetConfigXML(maName, "ma_schema_xml"); XmlNamespaceManager xmlnsManager = new XmlNamespaceManager(xmldoc.NameTable); xmlnsManager.AddNamespace("dsml", "http://www.dsml.org/DSML"); xmlnsManager.AddNamespace("ms-dsml", "http://www.microsoft.com/MMS/DSML"); XmlNodeList attributes = xmldoc.SelectNodes("//dsml:directory-schema/dsml:attribute-type", xmlnsManager); //add each attribute found to the schema foreach (XmlNode attrib in attributes) { string oid = attrib.SelectSingleNode("./dsml:syntax", xmlnsManager).InnerText; type.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute(maName + " - " + attrib.Attributes["id"].Value, FIMConfiguration.GetDataType(oid))); } schema.Types.Add(type); } return(schema); }
public SchemaAttribute GetSchemaAttribute(string prefix) { string attributeName = this.GetAttributeName(prefix); if (this.IsMultivalued) { return(SchemaAttribute.CreateMultiValuedAttribute(attributeName, this.AttributeType, this.Operation)); } else { return(SchemaAttribute.CreateSingleValuedAttribute(attributeName, this.AttributeType, this.Operation)); } }
private static SchemaType GetPersonType() { SchemaType personType = SchemaType.Create("user", false); personType.Attributes.Add(SchemaAttribute.CreateAnchorAttribute("objectID", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("company", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("displayName", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("firstName", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("lastName", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("usageLocation", AttributeType.String)); personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("userPrincipalName", AttributeType.String)); return(personType); }
private static SchemaType GetSchemaTypeUser(IOktaClient client) { SchemaType mmsType = SchemaType.Create("user", true); SchemaAttribute mmsAttribute = SchemaAttribute.CreateAnchorAttribute("id", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("status", AttributeType.String); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("created", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("activated", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("statusChanged", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("lastLogin", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("lastUpdated", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("passwordChanged", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("provider.type", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("provider.name", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateMultiValuedAttribute("enrolledFactors", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateMultiValuedAttribute("availableFactors", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("suspended", AttributeType.Boolean, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); foreach (SchemaAttribute a in SchemaProvider.GetSchemaJson(client)) { mmsType.Attributes.Add(a); } return(mmsType); }
internal static DataProviderMetaData Generate(Type type) { var tableName = TableNameAttribute.GetTableName(type); return(new DataProviderMetaData(type) { BaseClassTypesInOrder = GetParents(type), DrivedClassTypes = GetDrivedClasses(type), Properties = GetProperties(type).ToArray(), Schema = SchemaAttribute.GetSchema(type), TableName = tableName, TableAlias = tableName, IsSoftDeleteEnabled = SoftDeleteAttribute.IsEnabled(type, inherit: false) }); }
public static void SetData(this SchemaAttributeResponse resp, SchemaAttribute attr) { resp.Id = attr.Id; resp.CaseExact = attr.CaseExact; resp.Description = attr.Description; resp.MultiValued = attr.MultiValued; resp.Name = attr.Name; resp.Required = attr.Required; resp.Mutability = attr.Mutability; resp.Returned = attr.Returned; resp.Type = attr.Type; resp.Uniqueness = attr.Uniqueness; resp.CanonicalValues = SplitList(attr.CanonicalValues); resp.ReferenceTypes = SplitList(attr.ReferenceTypes); }
internal SchemaAttribute GetObject() { if (this.IsAnchor) { return(SchemaAttribute.CreateAnchorAttribute(this.Name, this.DataType, this.AllowedAttributeOperation)); } else if (this.IsMultiValued) { return(SchemaAttribute.CreateMultiValuedAttribute(this.Name, this.DataType, this.AllowedAttributeOperation)); } else { return(SchemaAttribute.CreateSingleValuedAttribute(this.Name, this.DataType, this.AllowedAttributeOperation)); } }
private static SchemaAttribute GetSchemaAttribute(string name, Type type) { SchemaAttribute schemaAttribute; bool isMultivalued = typeof(IEnumerable).IsAssignableFrom(type); if (isMultivalued) { schemaAttribute = SchemaAttribute.CreateMultiValuedAttribute(name, GetSchemaAttributeType(type)); } else { schemaAttribute = SchemaAttribute.CreateSingleValuedAttribute(name, GetSchemaAttributeType(type)); } return(schemaAttribute); }
/// <summary> /// Writes the <![CDATA[<attribute-changes>]]> node /// </summary> /// <param name="csentry">The CSEntryChange to serialize</param> /// <param name="writer">An open XmlWriter to write the serialized data to</param> /// <param name="schema">The current metadirectory services schema</param> private static void XmlWriteAttributeChangesNode(CSEntryChange csentry, XmlWriter writer, Schema schema) { writer.WriteStartElement("attribute-changes"); foreach (AttributeChange attributeChange in csentry.AttributeChanges) { writer.WriteStartElement("attribute-change"); writer.WriteElementString("name", attributeChange.Name); writer.WriteElementString("modification-type", attributeChange.ModificationType.ToString()); if (attributeChange.DataType == AttributeType.Undefined) { SchemaType type = schema.Types[csentry.ObjectType]; SchemaAttribute attribute = type.Attributes.FirstOrDefault(t => t.Name == attributeChange.Name); if (attribute == null) { writer.WriteElementString("data-type", AttributeType.Undefined.ToString()); } else { writer.WriteElementString("data-type", attribute.DataType.ToString()); } } else { writer.WriteElementString("data-type", attributeChange.DataType.ToString()); } writer.WriteStartElement("value-changes"); foreach (ValueChange valueChange in attributeChange.ValueChanges) { writer.WriteStartElement("value-change"); writer.WriteElementString("modification-type", valueChange.ModificationType.ToString()); writer.WriteElementString("value", valueChange.Value.ToSmartString()); writer.WriteEndElement(); } writer.WriteEndElement(); // </value-changes> writer.WriteEndElement(); // </attribute-change> } writer.WriteEndElement(); // </attribute-changes> }
private static SchemaType GetSchemaTypeUser() { SchemaType mmsType = SchemaType.Create("user", true); SchemaAttribute mmsAttribute = SchemaAttribute.CreateAnchorAttribute("id", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("onPremisesSamAccountName", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("upn", AttributeType.String, AttributeOperation.ImportOnly); mmsType.Attributes.Add(mmsAttribute); mmsAttribute = SchemaAttribute.CreateSingleValuedAttribute("displayName", AttributeType.String, AttributeOperation.ImportExport); mmsType.Attributes.Add(mmsAttribute); return(mmsType); }
public Schema GetSchema(KeyedCollection <string, ConfigParameter> configParameters) { Microsoft.MetadirectoryServices.SchemaType personType = Microsoft.MetadirectoryServices.SchemaType.Create("Person", false); this.GetMAConfig(configParameters); string[] rsaAttributes = new string[10]; rsaAttributes[0] = "First Name"; rsaAttributes[1] = "Last Name"; rsaAttributes[2] = "Middle Name"; rsaAttributes[3] = "User ID"; rsaAttributes[4] = "Manager Email Address"; rsaAttributes[5] = "Identity Source"; rsaAttributes[6] = "Security Domain"; rsaAttributes[7] = "Lockout Status"; rsaAttributes[8] = "Token Serial Number"; rsaAttributes[9] = "Token GUID"; foreach (string attribName in rsaAttributes) { if (attribName == "User ID") { personType.Attributes.Add(SchemaAttribute.CreateAnchorAttribute(attribName, AttributeType.String)); } else if (attribName == "Token Serial Number" || attribName == "Token GUID") { personType.Attributes.Add(SchemaAttribute.CreateMultiValuedAttribute(attribName, AttributeType.String)); } else { personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute(attribName, AttributeType.String)); } } Schema schema = Schema.Create(); schema.Types.Add(personType); return(schema); }
internal void AddArray(SchemaAttribute attribute) { Util.Log("Restriction.AddArray "); _rtype = RestrictionType.Array; _attribute = attribute; }
private static String ProcessArray(Type type, XMLNamespace xns) { Util.Log("RealSchemaType.ProcessArray Enter "+type); String qname = null; bool bbinary = false; Type elementType = type.GetElementType(); String elementTypeName = "ArrayOf"; while (elementType.IsArray) { elementTypeName = elementTypeName+"ArrayOf"; elementType = elementType.GetElementType(); } qname = RealSchemaType.TypeName(elementType, true, xns); int index = qname.IndexOf(":"); String prefix = qname.Substring(0, index); String wireName = qname.Substring(index+1); Util.Log("RealSchemaType.ProcessArray qname "+qname+" wirename "+wireName); int rank = type.GetArrayRank(); String rankStr = ""; if (rank > 1) rankStr = rank.ToString(CultureInfo.InvariantCulture); String csname =elementTypeName+wireName.Substring(0,1).ToUpper(CultureInfo.InvariantCulture)+wireName.Substring(1)+rankStr; csname = csname.Replace('+','N'); // need to get rid of + in nested classes ArraySchemaType ast = xns.LookupArraySchemaType(csname); if (ast == null) { ArraySchemaType cstype = new ArraySchemaType(type, csname, SchemaBlockType.ComplexContent, false); Restriction restriction = new Restriction(); SchemaAttribute attribute = new SchemaAttribute(); if (bbinary) attribute.AddArray(qname); else { String arrayTypeName = type.Name; index = arrayTypeName.IndexOf("["); attribute.AddArray(qname+arrayTypeName.Substring(index)); } restriction.AddArray(attribute); cstype.AddParticle(restriction); xns.AddArraySchemaType(cstype); } String returnStr = xns.Prefix+":"+csname; Util.Log("RealSchemaType.ProcessArray Exit "+returnStr); return returnStr; }
internal void AddEnumeration(SchemaAttribute attribute) { Util.Log("Restriction.AddEnumeration "); _rtype = RestrictionType.Enum; _attribute = attribute; }
internal void AddAttribute(SchemaAttribute attribute) { Util.Log("Restriction.AddAttribute "); _attribute = attribute; }