01: /**
02: * $Id: CMCUserImpl.java,v 1.2 2007/01/26 03:47:49 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.frole;
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.AMFilteredRole;
32: import com.iplanet.sso.SSOException;
33: import com.iplanet.am.sdk.AMException;
34:
35: public class CMCUserImpl extends CMCUserImplBase implements CMCUser {
36: public static String getStaticType() {
37: return "am-frole";
38: }
39:
40: public String getType() {
41: return getStaticType();
42: }
43:
44: public Set getMembershipByName() throws CMCException {
45: Set membership = new HashSet();
46:
47: try {
48: Set filteredRoleDNs = getAMUser().getFilteredRoleDNs();
49: for (Iterator i = filteredRoleDNs.iterator(); i.hasNext();) {
50: String froleDN = (String) i.next();
51: if (froleDN != null && froleDN.length() > 0) {
52: ConfigKey ck = new ConfigKey(new CMCPrincipal(
53: getType(), froleDN),
54: CMCRolePrincipal.MEMBER_ROLE);
55: membership.add(ck);
56: }
57: }
58: } catch (SSOException ssoe) {
59: throw new CMCException(ssoe);
60: } catch (AMException ame) {
61: throw new CMCException(ame);
62: }
63:
64: return membership;
65: }
66: }
|