01: /**
02: * $Id: CMCUserImpl.java,v 1.2 2007/01/26 03:47:52 portalbld Exp $
03: * Copyright 2005 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.community.mc.impl.am.role;
14:
15: import com.sun.portal.community.mc.CMCException;
16: import com.sun.portal.community.mc.CMCPrincipal;
17: import com.sun.portal.community.mc.CMCUser;
18: import com.sun.portal.community.mc.CMCNode;
19: import com.sun.portal.community.mc.ConfigTable;
20: import com.sun.portal.community.mc.ConfigTable.ConfigKey;
21: import com.sun.portal.community.mc.CMCRolePrincipal;
22: import com.sun.portal.community.mc.impl.Debug;
23: import com.sun.portal.community.mc.CMCFactory;
24: import com.sun.portal.community.mc.impl.am.CMCUserImplBase;
25: import java.io.File;
26: import java.util.HashSet;
27: import java.util.Iterator;
28: import java.util.Properties;
29: import java.util.Set;
30: import java.util.Collections;
31: import com.iplanet.am.sdk.AMUser;
32: import com.iplanet.am.sdk.AMRole;
33: import com.iplanet.am.sdk.AMFilteredRole;
34: import com.iplanet.am.sdk.AMOrganization;
35: import com.iplanet.sso.SSOException;
36: import com.iplanet.am.sdk.AMException;
37: import com.iplanet.am.util.SystemProperties;
38:
39: public class CMCUserImpl extends CMCUserImplBase implements CMCUser {
40: public static String getStaticType() {
41: return "am-role";
42: }
43:
44: public String getType() {
45: return getStaticType();
46: }
47:
48: public Set getMembershipByName() throws CMCException {
49: Set membership = new HashSet();
50:
51: try {
52: Set roleDNs = getAMUser().getRoleDNs();
53: for (Iterator i = roleDNs.iterator(); i.hasNext();) {
54: String roleDN = (String) i.next();
55: if (roleDN != null && roleDN.length() > 0) {
56: ConfigKey ck = new ConfigKey(new CMCPrincipal(
57: getType(), roleDN),
58: CMCRolePrincipal.MEMBER_ROLE);
59: membership.add(ck);
60: }
61: }
62: } catch (SSOException ssoe) {
63: throw new CMCException(ssoe);
64: } catch (AMException ame) {
65: throw new CMCException(ame);
66: }
67:
68: return membership;
69: }
70: }
|