この章では、Identity Governance Framework Identity Directory API (アイデンティティ・ディレクトリAPI)およびIdentity Directory Serviceのアーキテクチャと主要な機能について説明します。アイデンティティ・ディレクトリAPIは、ユーザー、グループおよび組織へのアクセスと管理をサポートします。また、新しいエンティティ・タイプおよびそれらのエンティティ間で定義されたリレーションシップをサポートするように拡張することもできます。この章の内容は次のとおりです。
アイデンティティ・ディレクトリAPIは、アイデンティティ管理アプリケーションがアイデンティティ情報にアクセスし、管理するためのサービスを提供します。柔軟性のあるこのAPIは、クライアントによって完全に構成可能であり、標準および固有のスキーマを持つ様々なアイデンティティ・ストアをサポートします。さらに堅牢であり、高可用性およびフェイルオーバー・サポートの両方を提供します。
このAPIは、Identity Governance Frameworkを使用し、Identity Governanceのすべての利点を提供します。このAPIはJava EEおよびJava SEの両方のモードで使用できます。Identity Governance Frameworkの詳細は、第1章「Identity Governance Frameworkの概要」を参照してください。
APIでサポートされるアクションは次のとおりです。
ユーザー、グループ、組織のエンティティおよび汎用エンティティに対する作成/読取り/更新/削除(CRUD)操作の実行
ユーザー・アカウント状態の取得操作
アイデンティティ・ディレクトリAPIの構成の共有
Oracle Internet Directory、Oracle Unified Directory、Oracle Directory Server EE、ADなどのディレクトリ・サーバーのサポート。
Identity Directory Serviceには次のものが含まれます。
アイデンティティ・ディレクトリAPI
ドメイン・アイデンティティ・ストアであるディレクトリ・サーバー内でアイデンティティ情報にアクセスし、管理する方法を提供します。エンティティ定義、エンティティ・リレーションシップ、およびその物理的なアイデンティティ・ストアの詳細は、アイデンティティ・ディレクトリの構成APIまたはMbeanを使用して構成できます。ディレクトリ・サービス・インスタンスの機能は、ゲッター・メソッドを使用して問い合せることができます。
アイデンティティ・ディレクトリAPIの構成
アイデンティティ・ディレクトリAPIの構成には、論理的なエンティティ構成と物理的なアイデンティティ・ストア構成が含まれます。
Identity Directory Serviceは、アイデンティティ管理製品がアイデンティティ・ディレクトリにアクセスし、管理するために使用する共通サービスです。Identity Directory Serviceの初期化にはアイデンティティ・ディレクトリAPIを使用します。Identity Directory Serviceは、異なるアイデンティティ・ストアに格納されているユーザーおよびグループ情報にアクセスし、それらを変更するためのインタフェースを提供します。アイデンティティ・ディレクトリはIdentity Directory Serviceのインスタンスであり、次のものが含まれています。
一意の名前 (IDS名)
論理的なエンティティ構成
物理的なアイデンティティ・ストア構成
アイデンティティ・ディレクトリAPIは、異なるアイデンティティ・ストアに格納されているユーザーおよびグループ情報にアクセスし、それらを変更するためのインタフェースを提供します。
Identity Directory Serviceの構成は、論理的なエンティティ構成、物理的なアイデンティティ・ストア構成およびオペレーション構成の組合せになります。
論理的なエンティティ構成およびオペレーション構成は、ids-config.xmlに格納されています。このファイルは、jps-config.xmlと同じディレクトリにあります。たとえば、Java EE環境では次の場所にあります。
DOMAIN_HOME/config/fmwconfig/ids-config.xml
物理的なアイデンティティ・ストア構成は、ovd/ids/adapters.os.xmlにあります。たとえば、ovdディレクトリは、Java EE環境では次の場所にあります。
DOMAIN_HOME/config/fmwconfig
この項の内容は、次のとおりです。
表2-1は、論理的なエンティティ構成のプロパティについて説明しています。
表2-1 論理的なエンティティ構成のプロパティ
| 名前 | 説明 |
|---|---|
|
|
Identity Directory Serviceを一意に識別する名前です。 |
|
|
Identity Directory Serviceの詳細な説明です。 |
|
|
有効な値は |
|
|
Identity Directory Serviceの構成対象である特定のアプリケーションを指定するプロパティです(オプション)。 |
表2-2は、論理的な属性を説明します。
表2-2 論理的なエンティティ属性
| 名前 | 説明 |
|---|---|
|
|
論理的な属性の名前です。 |
|
|
有効なデータ・タイプの値は、 |
|
|
論理的な属性の詳細な説明です。 |
|
|
デフォルトは |
|
|
デフォルトは |
表2-3は、論理的なエンティティ定義ごとに必要なプロパティを説明します。
表2-3 論理的なエンティティ定義のプロパティ
| 名前 | 説明 |
|---|---|
|
|
エンティティの名前。 |
|
|
有効なエンティティの値は、 |
|
|
エンティティを一意に識別する論理的な属性です。 |
|
|
このエンティティの作成が許可されている場合は |
|
|
このエンティティの変更が許可されている場合は |
|
|
このエンティティの削除が許可されている場合は |
|
|
このエンティティの検索が許可されている場合は |
|
|
次の詳細を含むエンティティ属性のリファレンスのリストです。
|
表2-4は、論理的なエンティティ・リレーションシップ定義ごとに必要なプロパティを説明します。
表2-4 論理的なエンティティ・リレーションシップのプロパティ
| 名前 | 説明 |
|---|---|
|
|
エンティティ・リレーションシップの名前です。 |
|
|
有効なエンティティの値は、 |
|
|
エンティティ・リレーションシップの最初のエンティティの名前です。 |
|
|
最初のエンティティの属性です。この属性値は、リレーションシップの2番目のエンティティに関連します。 |
|
|
エンティティ・リレーションシップの2番目のエンティティの名前です。 |
|
|
2番目のエンティティの属性です。 |
|
|
エンティティ・リレーションシップが再帰的な場合は |
表2-5は、物理的なアイデンティティ・ストア構成のプロパティについて説明します。
オペレーション構成には、主に、各エンティティのbase、name attributeおよびobjectclassの構成が含まれます。
表2-6は、オペレーション構成のエンティティを説明します。
この項の内容は、次のとおりです。
新しいアイデンティティ・ディレクトリを構成する際、エンティティのdefaultFetch属性の数はできるかぎり少なくしてください。また、jpegphotoのように値が大きい属性は、defaultFetchの値をfalseで構成します。これは、エンティティをバックエンドから読み取るたびに、すべてのdefaultFetch属性がバックエンド・ディレクトリから取得されるためです。defaultFetch属性が多すぎるとパフォーマンスに影響を与えます。
アイデンティティ・ディレクトリの初期化では、ArisIdスタック全体の初期化にかなりの負荷がかかります。そのため、アプリケーションでのアイデンティティ・ディレクトリの初期化は1回のみ、できれば起動時に実行し、全体を通して1つのハンドルのみを使用することをお薦めします。
この項では、次のコード・サンプルを示します。
次のコード・サンプルでは、アイデンティティ・ディレクトリへのハンドルを初期化して取得します。
import oracle.igf.ids.UserManager;
import oracle.igf.ids.GroupManager;
import oracle.igf.ids.config.OperationalConfig;
import oracle.igf.ids.IdentityDirectoryFactory;
import oracle.igf.ids.IdentityDirectory;
import oracle.igf.ids.IDSException;
public class IdsSample {
private IdentityDirectory ids;
private UserManager uMgr;
private GroupManager gMgr;
public IdsSample() throws IDSException {
// Set Operational Config
OperationalConfig opConfig = new OperationalConfig();
// Set the application credentials (optional). This
overrides the credentials set in
// physical ID store configuration
opConfig.setApplicationUser("cn=user1,dc=us,dc=example,dc=com");
opConfig.setApplicationPassword("password".toCharArray());
// Set search/crate base, name, objclass, etc. config
(optional). This overrides default operational configuration
in IDS
opConfig.setEntityProperty("User", opConfig.SEARCH_BASE,
"dc=us,dc=example,dc=com");
opConfig.setEntityProperty("User", opConfig.CREATE_BASE,
"dc=us,dc=example,dc=com");
opConfig.setEntityProperty("User", opConfig.FILTER
_OBJCLASSES, "person");
opConfig.setEntityProperty("User", opConfig.CREATE
_OBJCLASSES, "inetorgperson");
opConfig.setEntityProperty("Group", opConfig.SEARCH
_BASE, "cn=groups,dc=us,dc=example,dc=com");
opConfig.setEntityProperty("Group", opConfig.CREATE
_BASE, "cn=groups,dc=us,dc=example,dc=com");
opConfig.setEntityProperty("Group", opConfig.FILTER
_OBJCLASSES, "groupofuniquenames");
opConfig.setEntityProperty("Group", opConfig.CREATE
_OBJCLASSES, "groupofuniquenames");
// Get IdentityDirectory "ids1" configured in IDS config
IdentityDirectoryFactory factory = new
IdentityDirectoryFactory();
ids = factory.getIdentityDirectory("ids1", opConfig);
// Get UserManager and GroupManager handles
uMgr = ids.getUserManager();
gMgr = ids.getGroupManager();
}
}
次のコード・サンプルでは、JPSコンテキストからアイデンティティ・ディレクトリ・ハンドルを初期化して取得します。
import oracle.igf.ids.UserManager;
import oracle.igf.ids.GroupManager;
import oracle.igf.ids.config.OperationalConfig;
import oracle.igf.ids.IdentityDirectoryFactory;
import oracle.igf.ids.IdentityDirectory;
import oracle.igf.ids.IDSException;
import oracle.security.jps.JpsContext;
import oracle.security.jps.JpsContextFactory;
import oracle.security.jps.service.idstore.IdentityStoreService;
public class IdsSample {
private IdentityDirectory ids;
private UserManager uMgr;
private GroupManager gMgr;
public IdsSample() throws IDSException {
// Get IdentityDirectory from JpsContext
try {
JpsContext context =
JpsContextFactory.getContextFactory().getContext();
IdentityStoreService idstore = (IdentityStoreService)
context.getServiceInstance(IdentityStoreService.class);
ids = idstore.getIdentityStore();
} catch (Exception e) {
throw new IDSException(e);
}
// Get UserManager and GroupManager handles
uMgr = ids.getUserManager();
gMgr = ids.getGroupManager();
}
}
次のコード・サンプルでは、メモリー内アイデンティティ・ディレクトリ・ハンドルを初期化して取得します。
import java.util.ArrayList;
import java.util.List;
import oracle.igf.ids.UserManager;
import oracle.igf.ids.GroupManager;
import oracle.igf.ids.config.AttributeDef;
import oracle.igf.ids.config.AttributeRef;
import oracle.igf.ids.config.EntityDef;
import oracle.igf.ids.config.EntitiesConfig;
import oracle.igf.ids.config.EntityRelationship;
import oracle.igf.ids.config.IdentityStoreConfig;
import oracle.igf.ids.config.OperationalConfig;
import oracle.igf.ids.IdentityDirectoryFactory;
import oracle.igf.ids.IdentityDirectory;
import oracle.igf.ids.IDSException;
public class IdsSample {
private IdentityDirectory ids;
private UserManager uMgr;
private GroupManager gMgr;
public IdsSample() throws IDSException {
// Add Attribute definitions
List<AttributeDef> attrDefs = new ArrayList<AttributeDef>();
attrDefs.add(new AttributeDef("cn", AttributeDef.DataType.STRING));
attrDefs.add(new AttributeDef("firstname", AttributeDef.DataType.STRING));
attrDefs.add(new AttributeDef("sn", AttributeDef.DataType.STRING));
attrDefs.add(new AttributeDef("telephonenumber",
AttributeDef.DataType.STRING));
attrDefs.add(new AttributeDef("uid", AttributeDef.DataType.STRING));
attrDefs.add(new AttributeDef("uniquemember",
AttributeDef.DataType.STRING));
// Add User entity definition
List<EntityDef> entityDefs = new ArrayList<EntityDef>();
EntityDef userEntityDef = new EntityDef("User", EntityDef.EntityType.USER,
"cn");
userEntityDef.addAttribute(new AttributeRef("cn"));
userEntityDef.addAttribute(new AttributeRef("firstname"));
userEntityDef.addAttribute(new AttributeRef("sn"));
userEntityDef.addAttribute(new AttributeRef("telephonenumber"));
userEntityDef.addAttribute(new AttributeRef("uid"));
entityDefs.add(userEntityDef);
// Add Group entity definition
EntityDef groupEntityDef = new EntityDef("Group",
EntityDef.EntityType.GROUP, "cn");
groupEntityDef.addAttribute(new AttributeRef("cn"));
groupEntityDef.addAttribute(new AttributeRef("uniquemember", false,
AttributeRef.FilterType.EQUALS));
entityDefs.add(groupEntityDef);
// Add Entity relationship definition
List<EntityRelationship> entityRelations = new
ArrayList<EntityRelationship>();
entityRelations.add(new EntityRelationship("user_memberOfGroup",
EntityRelationship.RelationshipType.MANYTOMANY, "User",
"principal", "Group", "uniquemember"));
entityRelations.add(new EntityRelationship("group_memberOfGroup",
EntityRelationship.RelationshipType.MANYTOMANY, "Group",
"principal", "Group", "uniquemember", true));
EntitiesConfig entityCfg = new EntitiesConfig(attrDefs,
entityDefs, entityRelations);
// Create physical Identity Store configuration
IdentityStoreConfig idStoreCfg = new IdentityStoreConfig(
"ldap://host1:389,ldap://host2:389", "cn=orcladmin",
"password".toCharArray(), IdentityStoreConfig.IdentityStoreType.OID);
idStoreCfg.setHighAvailabilityOption(IdentityStoreConfig.HAOption.FAILOVER);
idStoreCfg.setProperty(IdentityStoreConfig.HEARTBEAT_INTERVAL, "60");
idStoreCfg.setProperty(IdentityStoreConfig.CONN_TIMEOUT, "30000"); //
milli sec
idStoreCfg.setProperty(IdentityStoreConfig.MIN_POOLSIZE, "5");
idStoreCfg.setProperty(IdentityStoreConfig.MAX_POOLSIZE, "10");
idStoreCfg.setProperty(IdentityStoreConfig.MAX_POOLWAIT, "1000"); //
milli sec
idStoreCfg.setProperty(IdentityStoreConfig.MAX_POOLCHECKS, "10");
idStoreCfg.setProperty(IdentityStoreConfig.FOLLOW_REFERRAL, "false");
idStoreCfg.setAttrMapping("firstname", "givenname");
// Set operational config
OperationalConfig opConfig = new OperationalConfig();
opConfig.setEntityProperty(opConfig.USER_ENTITY, opConfig.SEARCH_BASE,
"cn=users,dc=us,dc=example,dc=com");
opConfig.setEntityProperty(opConfig.USER_ENTITY, opConfig.CREATE_BASE,
"cn=users,dc=us,dc=example,dc=com");
opConfig.setEntityProperty(opConfig.USER_ENTITY, opConfig.NAME_ATTR,
"cn");
opConfig.setEntityProperty(opConfig.USER_ENTITY, opConfig.FILTER
_OBJCLASSES, "inetorgperson");
opConfig.setEntityProperty(opConfig.USER_ENTITY, opConfig.CREATE
_OBJCLASSES, "inetorgperson");
opConfig.setEntityProperty(opConfig.GROUP_ENTITY, opConfig.SEARCH_BASE,
"cn=groups,dc=us,dc=example,dc=com");
opConfig.setEntityProperty(opConfig.GROUP_ENTITY, opConfig.CREATE_BASE,
"cn=groups,dc=us,dc=example,dc=com");
opConfig.setEntityProperty(opConfig.GROUP_ENTITY, opConfig.NAME_ATTR,
"cn");
opConfig.setEntityProperty(opConfig.GROUP_ENTITY, opConfig.FILTER
_OBJCLASSES, "groupofuniquenames");
opConfig.setEntityProperty(opConfig.GROUP_ENTITY, opConfig.CREATE
_OBJCLASSES, "groupofuniquenames");
// Initialize Identity Store Service
IdentityDirectoryFactory factory = new IdentityDirectoryFactory();
ids = factory.getIdentityDirectory("ids1", entityCfg, idStoreCfg,
opConfig);
// Get UserManager and GroupManager handles
uMgr = ids.getUserManager();
gMgr = ids.getGroupManager();
}
}
次のコード・サンプルでは、アイデンティティ・ストアにユーザーを追加します。
Principal principal = null;
List<Attribute> attrs = new ArrayList<Attribute>();
attrs.add(new Attribute("commonname", "test1_user1"));
attrs.add(new Attribute("password", "mypassword".toCharArray()));
attrs.add(new Attribute("firstname", "test1"));
attrs.add(new Attribute("lastname", "user1"));
attrs.add(new Attribute("mail", "test1.user1@example.com"));
attrs.add(new Attribute("telephone", "1 650 123 0001"));
attrs.add(new Attribute("title", "Senior Director"));
attrs.add(new Attribute("uid", "tuser1"));
try {
CreateOptions createOpts = new CreateOptions();
principal = uMgr.createUser(attrs, createOpts);
System.out.println("Created user " + principal.getName());
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、指定されたプリンシパルのユーザーを取得します。
User user = null;
try {
ReadOptions readOpts = new ReadOptions();
user = uMgr.getUser(principal, readOpts);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、アイデンティティ・ディレクトリのユーザーを変更します。
try {
ModifyOptions modifyOpts = new ModifyOptions();
List<ModAttribute> attrs = new ArrayList<ModAttribute>();
attrs.add(new ModAttribute("description", "modified test user 1"));
user.modify(attrs, modifyOpts);
System.out.println("Modified user " + user.getName());
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、指定されたアイデンティティ値と一致するユーザーを取得します。
try {
ReadOptions readOpts = new ReadOptions();
User user = uMgr.searchUser("tuser1", readOpts);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、複雑な検索フィルタを使用したユーザーの検索方法を示します。
try {
// Complex search filter with nested AND and OR conditiions
SearchFilter filter = new SearchFilter(
SearchFilter.LogicalOp.OR,
new SearchFilter(SearchFilter.LogicalOp.AND,
new SearchFilter("firstname", SearchFilter.Operator.BEGINS_WITH,
"test"),
new SearchFilter("telephone", SearchFilter.Operator.CONTAINS,
"650")),
new SearchFilter(SearchFilter.LogicalOp.AND,
new SearchFilter("firstname", SearchFilter.Operator.BEGINS_WITH,
"demo"),
new SearchFilter(SearchFilter.LogicalOp.OR,
new SearchFilter("orgunit", SearchFilter.Operator.BEGINS_WITH,
"hr"),
new SearchFilter("orgunit", SearchFilter.Operator.BEGINS_WITH,
"it"),
new SearchFilter("telephone", SearchFilter.Operator.CONTAINS,
"650")));
// Requesting attributes
List<String> reqAttrs = new ArrayList<String>();
reqAttrs.add("jpegphoto");
SearchOptions searchOpts = new SearchOptions();
searchOpts.setPageSize(100);
searchOpts.setRequestedAttrs(reqAttrs);
searchOpts.setSortAttrs(new String[] {"firstname"});
ResultSet<User> sr = uMgr.searchUsers(filter, searchOpts);
while (sr.hasMore()) {
User user = sr.getNext();
System.out.println(user.getSubjectName());
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、ユーザー・パスワードの変更方法を示します。
ModifyOptions modOpts = new ModifyOptions();
try {
user.changePassword("welcome123".toCharArray(),
"welcome1".toCharArray(), modOpts);
System.out.println("Changed user password");
} catch (Exception e) {
System.out.println("Failed to change user password");
e.printStackTrace();
}
次のコード・サンプルでは、ユーザー・パスワードのリセット方法を示します。
ModifyOptions modOpts = new ModifyOptions();
try {
user.resetPassword("welcome123".toCharArray(), modOpts);
System.out.println("Reset user password");
} catch (Exception e) {
System.out.println("Failed to reset user password");
e.printStackTrace();
}
次のコード・サンプルでは、ユーザーの認証方法を示します。
ReadOptions readOpts = new ReadOptions();
try {
User user = uMgr.authenticateUser("tuser1",
"mypassword".toCharArray(), readOpts);
System.out.println("authentication success");
} catch (Exception e) {
System.out.println("Authentication failed. " + e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、ユーザーの削除方法を示します。
try {
DeleteOptions deleteOpts = new DeleteOptions();
uMgr.deleteUser(principal, deleteOpts);
System.out.println("Deleted user " + principal.getName());
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、グループの作成方法を示します。
Principal principal = null;
List<Attribute> attrs = new ArrayList<Attribute>();
attrs.add(new Attribute("name", "test1_group1"));
attrs.add(new Attribute("description", "created test group 1"));
attrs.add(new Attribute("displayname", "test1 group1"));
try {
CreateOptions createOpts = new CreateOptions();
principal = gMgr.createGroup(attrs, createOpts);
System.out.println("Created group " + principal.getName());
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、グループの検索方法を示します。
public void searchGroups() {
try {
SearchFilter filter = new SearchFilter("name",
SearchFilter.Operator.BEGINS_WITH, "test");
SearchOptions searchOpts = new SearchOptions();
searchOpts.setPageSize(10);
ResultSet<Group> sr = gMgr.searchGroups(filter, searchOpts);
while (sr.hasMore()) {
Group group = sr.getNext();
System.out.println(group.getSubjectName());
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、管理チェーンの取得方法を示します。
try {
ReadOptions readOpts = new ReadOptions();
User user = uMgr.searchUser("tuser1", readOpts);
SearchOptions searchOpts = new SearchOptions();
searchOpts.setPageSize(10);
int nLevels = 0;
ResultSet<User> sr = user.getManagementChain(nLevels, searchOpts);
while (sr.hasMore()) {
User u = sr.getNext();
System.out.println(u.getSubjectName());
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、ユーザーのReporteeの取得方法を示します。
// Get Reportees with target search filter
public void getReportees() {
try {
ReadOptions readOpts = new ReadOptions();
User user = uMgr.searchUser("tuser1", readOpts);
SearchOptions searchOpts = new SearchOptions();
searchOpts.setPageSize(20);
int nLevels = 0;
// get all the direct/indirect reporting of tuser1 who are
"developers"
SearchFilter filter = new SearchFilter("title",
SearchFilter.Operator.CONTAINS, "developer");
ResultSet<User> sr = user.getReportees(nLevels, filter, searchOpts);
while (sr.hasMore()) {
User u = sr.getNext();
System.out.println(u.getSubjectName());
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、グループにメンバーを追加します。
try {
ReadOptions readOpts = new ReadOptions();
User user = uMgr.searchUser("tuser1", readOpts);
Group group = gMgr.searchGroup("test1_group1", readOpts);
ModifyOptions modOpts = new ModifyOptions();
user.addMemberOf(group, modOpts);
System.out.println("added tuser1 as a member of test1_group1");
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
次のコード・サンプルでは、グループからメンバーを削除します。
try {
ReadOptions readOpts = new ReadOptions();
User user = uMgr.searchUser("tuser1", readOpts);
Group group = gMgr.searchGroup("test1_group1", readOpts);
ModifyOptions modOpts = new ModifyOptions();
group.deleteMember(user, modOpts);
System.out.println("deleted tuser1 from the group test1_group1");
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
|
注意: Identity Governance Framework/Identity Directory Serviceのグループ・メンバーシップ検索では、静的グループと動的グループの両方を評価します。ただし、メンバーシップの更新(追加/削除)は、動的グループではサポートされません。たとえば、グループからメンバーを削除する際に、そのメンバーがそのグループの動的メンバーである場合、動的グループでは削除操作がサポートされません。 |
次のコード・サンプルでは、ユーザーがメンバーとなっているグループをすべて取得します。
try {
ReadOptions readOpts = new ReadOptions();
User user = uMgr.searchUser("tuser1", readOpts);
SearchOptions searchOpts = new SearchOptions();
searchOpts.setPageSize(10);
int nLevels = 0;
ResultSet<Group> sr = user.getMemberOfGroups(nLevels, null,
searchOpts);
while (sr.hasMore()) {
Group group = sr.getNext();
System.out.println(group.getSubjectName());
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}