views:

104

answers:

1

Hi Everyone,

I have ADAM set-up & I've written web-services to complete admin tasks like adding new users etc. (I have multiple applications utilising the same ADAM instance)

What I am trying to achieve will probably sound a bit odd - but basically I want an admin user to be able to select which attributes the web service should return from ADAM. E.g. application 1 should return displayName & telephoneNumber but application 2 might not need the same attributes returned.

Currently I have set up a SQL Server table to store which attributes the user has selected to be returned & then in the web service looped through this to load the required attributes and add the results to an array to be returned (If your interested I'll add the code at the bottom).

I wanted to know whether there was a better way of doing this? Is it possible to store something like this within ADAM itself?

Thanks in advance for any help!

//using linq to access table
DataClasses1DataContext db = new DataClasses1DataContext();

var queryAttributes = from atr in db.AttributesToReturns
                      where atr.appNumber == appNumber
                      select atr;

 ArrayList userD = new ArrayList();
 foreach (var a in queryAttributes)
 {
      //the col 'attribute' contains the exact name in active direct e.g. displayName 
      string att = a.attribute.ToString();
      searcher.PropertiesToLoad.Add(att);
  }

 //--code omitted but here perform search & get req Directory Entry
 foreach (var a in queryAttributes)
 {
      string attributeName = a.attribute.ToString();

      try
     {
           string value = user.Properties[attributeName].Value.ToString();
          //do something with value - here i am updating a user object which will be added to the ArrayList the webservice is returning
           updateUser(u, attributeName, value); 
    }
      //if an error - just set value to empty
      catch (Exception ex)
      {
             string value = "NULL";
             updateUser(u, attributeName, value); 
      }


    }
      userD.Add(u);
+1  A: 

You could extend the schema http://technet.microsoft.com/en-us/library/cc759734(WS.10).aspx

This is for OpenLDAP but the LDF files should still work http://www.ibm.com/developerworks/websphere/library/techarticles/0302_singh/singh.html

Matthew Whited
hmmm so you mean create an attribute that stores multiple strings and add the attributes to return in there? I'll try it thanks :)
samcooper11
You can extend schema of existing objectclasses but you can also create new ones if you feel it better suited for your needs.
Matthew Whited
Also if you keep the LDF files you could extend other LDAP systems (OpenLDAP, Active Directory, and eDirectory to name a few) if ever needed.
Matthew Whited