Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

include enabled/disabled account status of LDAP User in results

When running a ldap search query, I want to return the status of the user within the results. i.e. include a attribute which identifies if the user account is disabled.

this is the filter I am using:

"(&(objectClass=user)(objectCategory=person))"

I've seen examples which allow you to filter out disabled accounts, but I want to return both enabled and disabled accounts but with a flag to identify this status. is it possible?

like image 647
Tim Avatar asked Oct 11 '25 21:10

Tim


1 Answers

found the answer if you do a bitwise

(userAccountControl & 2) != 0) // disabled
like image 120
Tim Avatar answered Oct 16 '25 06:10

Tim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!