ADAM - 有没有办法“存储” 应用程序特定属性?
我有 ADAM 设置和 我已经编写了 Web 服务来完成管理任务,例如添加新用户等。(我有多个应用程序使用同一个 ADAM 实例)
我想要实现的目标可能听起来有点奇怪 - 但基本上我希望管理员用户成为能够选择 Web 服务应从 ADAM 返回哪些属性。 例如,应用程序 1 应该返回 displayName & 电话号码,但应用程序 2 可能不需要返回相同的属性。
目前,我已经设置了一个 SQL Server 表来存储用户选择返回的属性和属性。 然后在 Web 服务中循环加载所需的属性并将结果添加到要返回的数组中(如果您感兴趣,我将在底部添加代码)。
我想知道是否有更好的方法来做到这一点? 是否可以在 ADAM 本身中存储类似的内容?
预先感谢您的任何帮助!
//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);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以扩展架构 http://technet.microsoft。 com/en-us/library/cc759734(WS.10).aspx
这是针对 OpenLDAP 的,但 LDF 文件应该仍然可以工作http://www.ibm.com/developerworks/websphere/library/techarticles/0302_singh/singh.html
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