Can anyone help me with this ?
What I am trying to do is retrieve a distinct list of company from the AD using LDAP query.
I wrote a query which returns all the company names, with duplicate values.
What I am trying to achieve is to get a list of distinct companies from AD.
My query for this is as given below.
DistinguishedName used is "ou=Users,o=rackspace"
And I am trying to filter it using the filter
Filter = "(company=*)"
Will you help me to get the list as I need it.
Thanks,
AR
Sorry, but LDAP in its filter definitions does not support a 'distinct' function.
Your filter will only return object who have a company value populated, but it will return duplicates.
You will have to use something else, whether that is something coded, or even a simple Excel spreadsheet to get the distinct values.
Related
I am trying to query the groups from Ldap starting with groupname-* and all users part of these groups.
Group filter condition is: (CN=groupname-*).
User filter condition is: (memberof=cn=groupname*,OU=Application,OU=Groupings,DC=xx,DC=com))
This is returning all groups matching the pattern. However I'm not able to get the users details.Works only when I specify the complete group name in user filter. Is there any way to get all users matching the group pattern.
It appears you are querying AD. When searching for memberOf, only complete values are supported, not wildcards.
So your best bet is to query the groups and read their member attribute in order to get a list of user DNs.
I would like to list fields on course eg title,header when use course-list. does anybody knows about a way to query by fields so the returned list of fields ?
when query on
GET api-2.0/courses/?category=Development&subcategory=Web Development&price=price-free&is_affiliate_agreed=True&instructional_level=all&fields=title,headline
result
result is count all query
I want to filter LDAP records to find entries with two attributes equal (also different).
Let us assume we have records with userid.
userid=10
userid=15
Each record have name and surname and I want to filter people with identical name and surname.
I can filter people with a particular name using following filter
(&(name=Mark)(surname=Mark))
But this filter is not correct
(=(name)(surname))
nor this
name=surname
This is not possible in LDAP. LDAP does not support relational queries even on the attribute level of the same entry.
See LDAP Query Basics.
.Hi i'm working with Asp and SQL-Server and i have no problem with writing dynamic query
I'm trying to Write a search page for searching people.
I have 3 related tables:
See my table diagram in : http://tinypic.com/r/21159go/5
What i'm trying to do is to design a search page that a person can search users with a dynamic number of attributes.
Example:
think that a username called "User1" has 3 attributes named "Attr1", "Attr2" and "Attr3" related to him in "UserAttributes" table and "User2" has 3 attributes named "Attr1", "Attr2" and "Attr4".
Attribute names and other bunch of items unrelated to search function saved in "Attributes" Table. This is because i want to relate an attribute between multiple users. and their values are stored in "UserAttributes" table.
Well someone wants to search upon "Attr1" and "Attr2" and wants to return all users that have "Attr1" and "Attr2" with specific value.
I need a query to know how to implement this. I can write a dynamic query with asp.net so if someone please give me a query for this one example i have brought, i would be thankful
P.S. This is not my real database. my real database is much more complex and has more fields and tables but i just cut it and brought only necessary items. and because attributes are very dynamic they can't be embedded in table columns.
Thanks in advance
Based on your DB diagram your code would be something like this
update:
SELECT u.*
FROM users AS u
LEFT OUTER JOIN UserAttributes AS ua1
ON u.USER_ID = ua1.USER_ID
LEFT OUTER JOIN UserAttributes AS ua2
ON u.USER_ID = ua2.USER_ID
WHERE (
ua1.attribute_id = 'att1'
AND ua.attribute_value = 'MyValue' )
AND (
ua2.attribute_id = 'att2'
AND ua.attribute_value = 'MyValue2' )
In where clause you would specify the attirbute_Id and what value you are expecting out of it. Than just decide if you want to restrict users to have all values match or just one of them, in that case modify AND between statements to be OR
if you just want to do this quick and dirty you can create your own class library that can create adhoc sql that will pass to the database.
if you want more organized matter, create SP that will bring back users and accepts any left of id and value. Do a lot of that by passing list separated by comma, colon or semicolon. Than split it up in SP and filter results based on those values
there are many other alternatives like EntityFramework, LINQ-to-SQL and other options, just need to figure out what works best for you, how much time you want to spend on it and how easy will it be to support later.
I'm trying to make an LDAP query, to get a list from all my groups/members. I can't figure out how can i do this. All my tries were unsuccesfull.
My "AD tree": mydomain.local/Mybusiness/Distribution Groups/ here are my groups
I tried with somethin' like this:
(objectCategory=user)
(memberOf=CN=Distribution Groups,OU=Mybusiness,DC=mydomain.local,DC=com)
I appreciate if somebody could help me to write an ldap query, which gives a list with my groups and the members of this groups.
The query should be:
(&(objectCategory=user)(memberOf=CN=Distribution Groups,OU=Mybusiness,DC=mydomain.local,DC=com))
You missed & and ()
Active Directory does not store the group membership on user objects. It only stores the Member list on the group. The tools show the group membership on user objects by doing queries for it.
How about:
(&(objectClass=group)(member=cn=my,ou=full,dc=domain))
(You forgot the (& ) bit in your example in the question as well).
The good way to get all the members from a group is to, make the DN of the group as the searchDN and pass the "member" as attribute to get in the search function. All of the members of the group can now be found by going through the attribute values returned by the search.
The filter can be made generic like (objectclass=*).