001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: AMUser.java,v 1.4 2008/06/25 05:41:23 qcheng Exp $
026 *
027 */
028
029package com.iplanet.am.sdk;
030
031import java.util.Set;
032
033import com.iplanet.sso.SSOException;
034
035/**
036 * This interface provides methods to manage user. <code>AMUser</code> objects
037 * can be obtained by using <code>AMStoreConnection</code>. A handle to this
038 * object can be obtained by using the DN of the object.
039 * 
040 * <PRE>
041 * AMStoreConnection amsc = new AMStoreConnection(ssotoken); if
042 * (amsc.doesEntryExist(uDN)) { AMUser user = amsc.getUser(uDN); }
043 * </PRE>
044 * 
045 *
046 * @deprecated  As of Sun Java System Access Manager 7.1.
047 * @supported.all.api
048 */
049public interface AMUser extends AMObject {
050
051    /**
052     * Renames the user name (ie., naming attribute of user entry) in the data
053     * store.
054     * 
055     * <p>
056     * <B>Note:</B> This operation directly commits the the user name changes
057     * to the data store. However, it does not save the modified/added
058     * attributes. For saving them explicitly to the data store, use
059     * {@link AMObject#store store()} method to save the attributes.
060     * 
061     * @param newName
062     *            The new user name
063     * @param deleteOldName
064     *            if true deletes the old name, otherwise retains the old name.
065     * @return the new <code>DN</code> value for the user
066     * 
067     * @throws AMException
068     *             if an error is encountered when trying to access/retrieve
069     *             data from the data store
070     * @throws SSOException
071     *             if the single sign on token is no longer valid.
072     */
073    public String rename(String newName, boolean deleteOldName)
074            throws AMException, SSOException;
075
076    /**
077     * Gets all the filtered roles the user is in.
078     * 
079     * @return The Set of filtered role DN's the user is in.
080     * 
081     * @throws AMException
082     *             if an error is encountered when trying to access/retrieve
083     *             data from the data store
084     * @throws SSOException
085     *             if the single sign on token is no longer valid.
086     */
087    public Set getFilteredRoleDNs() throws AMException, SSOException;
088
089    /**
090     * Gets all the static roles the user is in.
091     * 
092     * @return The Set of static role DN's the user is in.
093     * 
094     * @throws AMException
095     *             if an error is encountered when trying to access/retrieve
096     *             data from the data store
097     * @throws SSOException
098     *             if the single sign on token is no longer valid.
099     */
100    public Set getRoleDNs() throws AMException, SSOException;
101
102    /**
103     * Gets all the static and filtered roles the user is in.
104     * 
105     * @return The Set of static and filtered role DN's the user is in.
106     * 
107     * @throws AMException
108     *             if an error is encountered when trying to access/retrieve
109     *             data from the data store
110     * @throws SSOException
111     *             if the single sign on token is no longer valid.
112     */
113    public Set getAllRoleDNs() throws AMException, SSOException;
114
115    /**
116     * Assigns a role to the user.
117     * 
118     * @param role
119     *            The Role that the user is assigned to.
120     * 
121     * @throws AMException
122     *             if an error is encountered when trying to access/retrieve
123     *             data from the data store
124     * @throws SSOException
125     *             if the single sign on token is no longer valid.
126     */
127    public void assignRole(AMRole role) throws AMException, SSOException;
128
129    /**
130     * Assigns a role to the user.
131     * 
132     * @param roleDN
133     *            The role DN that the user is assigned to.
134     * 
135     * @throws AMException
136     *             if an error is encountered when trying to access/retrieve
137     *             data from the data store
138     * @throws SSOException
139     *             if the single sign on token is no longer valid.
140     */
141    public void assignRole(String roleDN) throws AMException, SSOException;
142
143    /**
144     * Removes a role that is assigned to the user.
145     * 
146     * @param role
147     *            The Role that the user is assigned to.
148     * 
149     * @throws AMException
150     *             if an error is encountered when trying to access/retrieve
151     *             data from the data store
152     * @throws SSOException
153     *             if the single sign on token is no longer valid.
154     */
155    public void removeRole(AMRole role) throws AMException, SSOException;
156
157    /**
158     * Removes a role that is assigned to the user.
159     * 
160     * @param roleDN
161     *            The role DN that the user is assigned to.
162     * 
163     * @throws AMException
164     *             if an error is encountered when trying to access/retrieve
165     *             data from the data store
166     * @throws SSOException
167     *             if the single sign on token is no longer valid.
168     */
169    public void removeRole(String roleDN) throws AMException, SSOException;
170
171    /**
172     * Gets all the static groups the user is in.
173     * 
174     * @return The Set of static group DN's the user is in.
175     * 
176     * @throws AMException
177     *             if an error is encountered when trying to access/retrieve
178     *             data from the data store
179     * @throws SSOException
180     *             if the single sign on token is no longer valid.
181     */
182    public Set getStaticGroupDNs() throws AMException, SSOException;
183
184    /**
185     * Assigns a static group to the user.
186     * 
187     * @param group
188     *            The static group that the user is assigned to.
189     * @throws AMException
190     *             if an error is encountered when trying to access/retrieve
191     *             data from the data store.
192     * @throws SSOException
193     *             if the single sign on token is no longer valid.
194     */
195    public void assignStaticGroup(AMStaticGroup group) throws AMException,
196            SSOException;
197
198    /**
199     * Assigns a static group to the user.
200     * 
201     * @param groupDN
202     *            The static group DN that the user is assigned to.
203     * 
204     * @throws AMException
205     *             if an error is encountered when trying to access/retrieve
206     *             data from the data store
207     * @throws SSOException
208     *             if the single sign on token is no longer valid.
209     */
210    public void assignStaticGroup(String groupDN) throws AMException,
211            SSOException;
212
213    /**
214     * Removes a static group that is assigned to the user.
215     * 
216     * @param group
217     *            The static group that the user is assigned to.
218     * 
219     * @throws AMException
220     *             if an error is encountered when trying to access/retrieve
221     *             data from the data store
222     * @throws SSOException
223     *             if the single sign on token is no longer valid.
224     */
225    public void removeStaticGroup(AMStaticGroup group) throws AMException,
226            SSOException;
227
228    /**
229     * Removes a static group that is assigned to the user.
230     * 
231     * @param groupDN
232     *            The static group DN that the user is assigned to.
233     * 
234     * @throws AMException
235     *             if an error is encountered when trying to access/retrieve
236     *             data from the data store
237     * @throws SSOException
238     *             if the single sign on token is no longer valid.
239     */
240    public void removeStaticGroup(String groupDN) throws AMException,
241            SSOException;
242
243    /**
244     * Gets all the assignable dynamic groups the user is in.
245     * 
246     * @return The Set of assignable dynamic group DN's the user is in.
247     * 
248     * @throws AMException
249     *             if an error is encountered when trying to access/retrieve
250     *             data from the data store
251     * @throws SSOException
252     *             if the single sign on token is no longer valid.
253     */
254    public Set getAssignableDynamicGroupDNs() throws AMException, SSOException;
255
256    /**
257     * Assigns a assignable dynamic group to the user.
258     * 
259     * @param assignableDynamicGroup
260     *            The assignable dynamic group that the user is assigned to.
261     * @throws AMException
262     *             if an error is encountered when trying to access/retrieve
263     *             data from the data store
264     * @throws SSOException
265     *             if the single sign on token is no longer valid.
266     */
267    public void assignAssignableDynamicGroup(
268            AMAssignableDynamicGroup assignableDynamicGroup)
269            throws AMException, SSOException;
270
271    /**
272     * Assigns a assignable dynamic group to the user.
273     * 
274     * @param assignableDynamicGroupDN
275     *            The assignable dynamic group DN that the user is assigned to.
276     * 
277     * @throws AMException
278     *             if an error is encountered when trying to access/retrieve
279     *             data from the data store
280     * @throws SSOException
281     *             if the single sign on token is no longer valid.
282     */
283    public void assignAssignableDynamicGroup(String assignableDynamicGroupDN)
284            throws AMException, SSOException;
285
286    /**
287     * Removes a assignable dynamic group that is assigned to the user.
288     * 
289     * @param assignableDynamicGroup
290     *            The assignable dynamic group that the user is assigned to.
291     * 
292     * @throws AMException
293     *             if an error is encountered when trying to access/retrieve
294     *             data from the data store
295     * @throws SSOException
296     *             if the single sign on token is no longer valid.
297     */
298    public void removeAssignableDynamicGroup(
299            AMAssignableDynamicGroup assignableDynamicGroup)
300            throws AMException, SSOException;
301
302    /**
303     * Removes a assignable dynamic group that is assigned to the user.
304     * 
305     * @param assignableDynamicGroupDN
306     *            The assignable dynamic group DN that the user is assigned to.
307     * 
308     * @throws AMException
309     *             if an error is encountered when trying to access/retrieve
310     *             data from the data store
311     * @throws SSOException
312     *             if the single sign on token is no longer valid.
313     */
314    public void removeAssignableDynamicGroup(String assignableDynamicGroupDN)
315            throws AMException, SSOException;
316
317    /**
318     * Activates the user.
319     * 
320     * @throws AMException
321     *             if an error is encountered when trying to access/retrieve
322     *             data from the data store
323     * @throws SSOException
324     *             if the single sign on token is no longer valid.
325     */
326    public void activate() throws AMException, SSOException;
327
328    /**
329     * Deactivates the user.
330     * 
331     * @throws AMException
332     *             if an error is encountered when trying to access/retrieve
333     *             data from the data store
334     * @throws SSOException
335     *             if the single sign on token is no longer valid.
336     */
337    public void deactivate() throws AMException, SSOException;
338
339    /**
340     * Returns true if the user is activated.
341     * 
342     * @return true if the user is activated.
343     * @throws AMException
344     *             if an error is encountered when trying to access/retrieve
345     *             data from the data store
346     * @throws SSOException
347     *             if the single sign on token is no longer valid.
348     */
349    public boolean isActivated() throws AMException, SSOException;
350
351    /**
352     * Gets all service names that are assigned to the user.
353     * 
354     * @return The Set of service names that are assigned to the user.
355     * 
356     * @throws AMException
357     *             if an error is encountered when trying to access/retrieve
358     *             data from the data store
359     * @throws SSOException
360     *             if the single sign on token is no longer valid.
361     */
362    public Set getAssignedServices() throws AMException, SSOException;
363
364    /**
365     * Assigns services to the user.
366     * 
367     * @param serviceNames
368     *            Set of service names
369     * @throws AMException
370     *             if an error is encountered when trying to access/retrieve
371     *             data from the data store
372     * @throws SSOException
373     *             if the single sign on token is no longer valid.
374     * @see com.iplanet.am.sdk.AMObject#assignServices(java.util.Map)
375     */
376    public void assignServices(Set serviceNames) throws AMException,
377            SSOException;
378
379}