portals-jetspeed-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ford, Jennifer M." <JENNF...@SOUTHERNCO.COM>
Subject RE: Custom pages for users
Date Fri, 16 Nov 2007 16:01:16 GMT
If you make some templates for each role type and place them under
_role, you can set up the user to get a copy of those pages with just a
small amount of work.  Here's some code from the processAction of my
custom user creation portlet:

logger.info("Adding user: " + userID);
			
			//Set up new user
	
user.setUserName(StringEscapeUtils.escapeSql(actionRequest.getParameter(
"user_name")));
	
user.setEmail(StringEscapeUtils.escapeSql(actionRequest.getParameter("em
ail")));
			String active =
(actionRequest.getParameter("active").equals("false")) ? "0" : "1";
			user.setIsActive(active);
			
			user.setPassword("P0rt@l");
			
			try {
				if
(userManager.userExists(user.getUserID())) {
					appendStartErrorText("User
already exists in portal.  See User Administration Portlet for
information");				
				} else {
					logger.info("Inserting user");
					
					//Add the user to the portal
	
userManager.addUser(user.getUserID(), user.getPassword());
	
userManager.setPasswordUpdateRequired(user.getUserID(), true);
					
					//Add the roles to the portal
user
					for (Iterator i =
user.getRoles().iterator(); i.hasNext();) {
						PortalRole role =
(PortalRole) i.next();
	
roleManager.addRoleToUser(user.getUserID(), role.getRoleCode());
					}	
					
					//Give everyone their own copy
of pages
					logger.info("Adding pages for
user");
					PageManager pageManager =
(PageManager) getPortletContext().getAttribute(
	
CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);
	
pageManager.createUserHomePagesFromRoles(userManager.getUser(user.getUse
rID()).getSubject());
					
					logger.info("Setting user
profile to point to user/role pages");
					PrincipalRule rule =
profiler.createPrincipalRule();
	
rule.setPrincipalName(user.getUserID());
					rule.setLocatorName("page");
	
rule.setProfilingRule(profiler.getRule("user-rolecombo-fallback"));
	
profiler.storePrincipalRule(rule);
				}
			} catch (Exception e) {
				System.out.println("Error: " +
e.getLocalizedMessage());
			}

 

-----Original Message-----
From: $aurabh Vig [mailto:saurabhvig@gmail.com] 
Sent: Thursday, November 15, 2007 7:13 PM
To: Jetspeed Users List
Subject: Re: Custom pages for users

Thanks Jennifer,

Could just figure that out yesterday with some hit and trials, and was
trying to see if there was some way with the admin portals to do that
automatically when a new user is created.
I guess writing a new user creation portlet is a way. anything better
than that??


Regards,
Saurabh

On Nov 15, 2007 9:38 PM, Ford, Jennifer M. <JENNFORD@southernco.com>
wrote:

> Yes, if you make a directory for the user under pages/_user and add a 
> copy of the page to that, they can modify the page as much as they 
> want and it won't affect any other users of your portal.
>
> -----Original Message-----
> From: $aurabh Vig [mailto:saurabhvig@gmail.com]
> Sent: Wednesday, November 14, 2007 9:45 PM
> To: Jetspeed Users List
> Subject: Custom pages for users
>
> Hi,
>
> Is it possible to have the same page on any site/subsite customized 
> diffrerently for different users?
> I mean each user gets a different view on the same page by editing the

> page himself, something like igoogle.
>
>
> Regards,
> Saurabh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Mime
View raw message