* You are viewing the archive for the ‘Code’ Category

PHP Active Directory Integration: get userAccountControl attributes

While trying to integrate an AD based login in my php application, I came across the problem of checking which user accounts were not disabled.

After going through some forums I did the following to see accounts which were not disabled:
$result = ldap_search($ad, “OU=Users,OU=Office1,DC=country,DC=company,DC=com”, “(&(objectCategory=user)(!(userAccountControl=514)))”);

Microsoft returns the flags set for any user in the userAccountControl attribute in a cumulative manner. The flag values used by Active Directory are mentioned here.

So e.g.
John has a Normal Account [Flag 512]
Alex had a Normal Account [Flag 512] but now has been disabled [Flag 2] so the status on … Continue Reading

Some of the tools I use

I  was going to write about Notepad2 but just didn’t get around doing it. So here I am just listing out a few tools I use :

Notepad2 (Windows notepad is dead, this one has truly replaced all my windows systems)

WinMerge (diff tool)

Softerra LDAP Administrator (amazing ldap manager)

Easy Eclipse (eclipse installation for the truly lazy people)

TAR to the rescue

Recently I had to automate a few very VERY redundant tasks on Mac. We have been using PowerGlot – an application used to localize nib and string resources. The following were the steps which are used to localize any application:

Choose the English Resource Folder (which contains nib and string resources)
Choose the Target Resource Folder (where the localized files would be placed)
Give the glossary which has the translations stored in it.

I checked out the source code from the CVS repository on my system, and ran the script which finished off the work in a few minutes.

Little did … Continue Reading