/// <summary> Constructs an object class definition from the raw string value
        /// returned from a directory query for "objectClasses".
        /// 
        /// </summary>
        /// <param name="raw">     The raw string value returned from a directory
        /// query for "objectClasses".
        /// </param>
        public LdapObjectClassSchema(System.String raw)
            : base(LdapSchema.schemaTypeNames[LdapSchema.OBJECT_CLASS])
        {
            try
            {
                SchemaParser parser = new SchemaParser(raw);

                if (parser.Names != null)
                {
                    base.names = new System.String[parser.Names.Length];
                    parser.Names.CopyTo(base.names, 0);
                }

                if ((System.Object) parser.ID != null)
                    base.oid = parser.ID;
                if ((System.Object) parser.Description != null)
                    base.description = parser.Description;
                base.obsolete = parser.Obsolete;
                if (parser.Required != null)
                {
                    required = new System.String[parser.Required.Length];
                    parser.Required.CopyTo(required, 0);
                }
                if (parser.Optional != null)
                {
                    optional = new System.String[parser.Optional.Length];
                    parser.Optional.CopyTo(optional, 0);
                }
                if (parser.Superiors != null)
                {
                    superiors = new System.String[parser.Superiors.Length];
                    parser.Superiors.CopyTo(superiors, 0);
                }
                type = parser.Type;
                System.Collections.IEnumerator qualifiers = parser.Qualifiers;
                AttributeQualifier attrQualifier;
                while (qualifiers.MoveNext())
                {
                    attrQualifier = (AttributeQualifier) qualifiers.Current;
                    setQualifier(attrQualifier.Name, attrQualifier.Values);
                }
                base.Value = formatString();
            }
            catch (System.IO.IOException e)
            {
            }
            return ;
        }
Example #2
0
		/// <summary> Constructs an attribute definition from the raw string value returned
		/// on a directory query for "attributetypes".
		/// 
		/// </summary>
		/// <param name="raw">     The raw string value returned on a directory
		/// query for "attributetypes".
		/// </param>
		public LdapAttributeSchema(System.String raw):base(LdapSchema.schemaTypeNames[LdapSchema.ATTRIBUTE])
		{
			InitBlock();
			try
			{
				SchemaParser parser = new SchemaParser(raw);
				
				if (parser.Names != null)
					base.names = parser.Names;
				if ((System.Object) parser.ID != null)
					base.oid = parser.ID;
				if ((System.Object) parser.Description != null)
					base.description = parser.Description;
				if ((System.Object) parser.Syntax != null)
					syntaxString = parser.Syntax;
				if ((System.Object) parser.Superior != null)
					superior = parser.Superior;
				single = parser.Single;
				base.obsolete = parser.Obsolete;
				System.Collections.IEnumerator qualifiers = parser.Qualifiers;
				AttributeQualifier attrQualifier;
				while (qualifiers.MoveNext())
				{
					attrQualifier = (AttributeQualifier) qualifiers.Current;
					setQualifier(attrQualifier.Name, attrQualifier.Values);
				}
				base.Value = formatString();
			}
			catch (System.IO.IOException e)
			{
				throw new System.SystemException(e.ToString());
			}
			return ;
		}
Example #3
0
        /// <summary>Gets the schema of a given object class.
        /// </summary>
        /// <param name="objClass">Name of object class</param>
        /// <returns>A SchemaParser object</returns>
        public SchemaParser GetObjectClassSchema(string objClass)
        {
            LdapEntry[] entries;

            entries = server.Search (
                server.GetSchemaDN (),
                LdapConnection.SCOPE_BASE,
                server.DefaultSearchFilter,
                new string[] { "objectclasses" });

            foreach (LdapEntry entry in entries) {

                LdapAttribute la = entry.getAttribute ("objectclasses");
                foreach (string s in la.StringValueArray) {
                    SchemaParser sp = new SchemaParser (s);

                    foreach (string a in sp.Names)
                        if (objClass.Equals (a))
                            return sp;
                }
            }

            return null;
        }
Example #4
0
        /// <summary>Gets the servers matching rules (if available).
        /// </summary>
        /// <returns>matching rules</returns>
        public string[] GetMatchingRules()
        {
            LdapEntry[] entries = server.Search (
                                    server.GetSchemaDN (),
                                    LdapConnection.SCOPE_BASE,
                                    "",
                                    new string[] { "matchingRules" });

            if (entries == null)
                return null;

            List<string> tmp = new List<string> ();
            LdapAttribute la = entries[0].getAttribute ("matchingRules");

            foreach (string s in la.StringValueArray) {
                SchemaParser sp = new SchemaParser (s);
                tmp.Add (sp.Names[0]);
            }

            tmp.Sort ();
            return tmp.ToArray ();
        }
Example #5
0
        /// <summary>Gets the schema information for a given matching rule
        /// </summary>
        /// <param name="attrType">Matching rule</param>
        /// <returns>schema information</returns>
        public SchemaParser GetMatchingRule(string matName)
        {
            LdapEntry[] entries = server.Search (
                                    server.GetSchemaDN (),
                                    LdapConnection.SCOPE_BASE,
                                    "",
                                    new string[] { "matchingRules" });

            if (entries == null)
                return null;

            LdapAttribute la = entries[0].getAttribute ("matchingRules");
            foreach (string s in la.StringValueArray) {
                SchemaParser sp = new SchemaParser (s);

                foreach (string a in sp.Names)
                    if (matName.Equals (a))
                            return sp;
            }

            return null;
        }
Example #6
0
        /// <summary>Gets the schema information for a given ldap syntax
        /// </summary>
        /// <param name="attrType">LDAP syntax</param>
        /// <returns>schema information</returns>
        public SchemaParser GetLdapSyntax(string synName)
        {
            LdapEntry[] entries = server.Search (
                                    server.GetSchemaDN (),
                                    LdapConnection.SCOPE_BASE,
                                    "",
                                    new string[] { "ldapSyntaxes" });

            if (entries == null)
                return null;

            LdapAttribute la = entries[0].getAttribute ("ldapSyntaxes");
            foreach (string s in la.StringValueArray) {
                SchemaParser sp = new SchemaParser (s);
                if (synName.Equals (sp.Description))
                        return sp;
            }

            return null;
        }
Example #7
0
        /// <summary>Gets the schema for a given attribute type
        /// </summary>
        /// <param name="attrType">Attribute type</param>
        /// <returns>A SchemaParser object</returns>
        public SchemaParser GetAttributeTypeSchema(string attrType)
        {
            LdapEntry[] entries = server.Search (
                                    server.GetSchemaDN (),
                                    LdapConnection.SCOPE_BASE,
                                    server.DefaultSearchFilter,
                                    new string[] { "attributetypes" });

            if (entries == null)
                return null;

            foreach (LdapEntry entry in entries) {

                LdapAttribute la = entry.getAttribute ("attributetypes");
                foreach (string s in la.StringValueArray) {

                    SchemaParser sp = new SchemaParser (s);
                    foreach (string a in sp.Names)
                        if (attrType.Equals (a))
                            return sp;
                }
            }

            return null;
        }