1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.administration;
18
19 import java.util.List;
20 import java.util.Map;
21
22 import javax.portlet.PortletConfig;
23 import javax.portlet.PortletRequest;
24 import javax.portlet.PortletResponse;
25 import org.apache.jetspeed.security.User;
26
27 /***
28 * PortalAdministration
29 *
30 * Aggregate portal administration functions:
31 * - Emails
32 * - Registration
33 * - Password Generation
34 *
35 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
36 * @version $Id: $
37 */
38 public interface PortalAdministration
39 {
40 /***
41 * Registers and creates a new user, assigning userInfo, roles, groups,
42 * profiling rules and a folder template. If any values are null, defaults
43 * are used from the system wide configuration.
44 *
45 * @param userName Unique user principal identifier
46 * @param password Password for this user
47 * @param roles A list of roles to assign to this user
48 * @param groups A list of groups to assign to this user
49 * @param userInfo Portlet API User Information Attributes name value pairs (PLT.D)
50 * @param rules A map of name value pairs of profiling rules.
51 * Well known rules names are 'page' and 'menu'
52 * @param folderTemplate The full PSML path name of a folder to be deep
53 * copied as the new user's set of folders, pages, links
54 * @param subsite The subsite folder to place the new user in
55 * @since 2.1.2
56 */
57 void registerUser(String userName,
58 String password,
59 List roles,
60 List groups,
61 Map userInfo,
62 Map rules,
63 String template,
64 String subsiteFolder)
65 throws RegistrationException;
66
67 void registerUser(String userName,
68 String password,
69 List roles,
70 List groups,
71 Map userInfo,
72 Map rules,
73 String template)
74 throws RegistrationException;
75
76 /***
77 * Register a new user using all default values
78 *
79 * @param userName
80 * @param password
81 */
82 void registerUser(String userName, String password)
83 throws RegistrationException;
84
85 /***
86 * Generate a unique password
87 *
88 * @return unique password
89 */
90 String generatePassword();
91
92 /***
93 * Helper to send an email to a recipient
94 *
95 * @param recipient the email address of the recipient
96 * @param localizedSubject the subject of the email as a localized string
97 * @param message the email message content
98 * @parm userAttributes map of user attributes
99 * @throws AdministrationEmailException
100 */
101 public void sendEmail(PortletConfig portletConfig,
102 String emailAddress,
103 String localizedSubject,
104 String templatePath,
105 Map userAttributes)
106 throws AdministrationEmailException;
107
108 /***
109 * Lookup a user given an email address
110 *
111 * @param email Given email address
112 * @return a Jetspeed <code>User</code>, or throw exception if not found
113 * @throws AdministrationEmailException
114 */
115 public User lookupUserFromEmail(String email)
116 throws AdministrationEmailException;
117
118 /***
119 * Provide a common way to get portal URLs
120 * Necessary for generating return URLs for features such as
121 * forgotten password. The URL generated will be a combination
122 * of the Jetspeed base URL plus the path parameter appended
123 * Example:
124 * base URL = http://www.apache.org/jetspeed/portal
125 * path = /system/forgotten-password.psml
126 * Returns:
127 * http://www.apache.org/jetspeed/portal/system/forgotten-password.psml
128 *
129 * @param request The portlet request.
130 * @param response The portlet response, used to encode the path
131 * @param path The relative path to a portal resource
132 * @return the base Jetspeed portal URL plus the appended path parameter
133 */
134 String getPortalURL(PortletRequest request, PortletResponse response, String path);
135
136
137 /***
138 * @param guid The ID which is passed throughte URL to the user
139 * @return
140 */
141 public Map getNewLoginInfo(String guid);
142 /***
143 * @param guid the ID which is passed through the URL to the user..
144 * @param info a Map, info from which will be used to reset the password
145 * the password in this case is NOT encrypted, but this should probably
146 * change if this information is stored on disk... ie a database
147 */
148 public void putNewLoginInfo(String guid, Map info);
149
150 /***
151 * @param guid the ID which will be removed from the storage when the info is no longer valid
152 */
153 public void removeNewLoginInfo(String guid);
154
155 }
156