[jboss-user] [JBoss Portal] New message: "Re: Portlet that lists all available portals for a user"
Eli Galicia
do-not-reply at jboss.com
Wed Jan 27 09:18:33 EST 2010
User development,
A new message was posted in the thread "Portlet that lists all available portals for a user":
http://community.jboss.org/message/522521#522521
Author : Eli Galicia
Profile : http://community.jboss.org/people/superdepor
Message:
--------------------------------------------------------------
I'm right now able to list and display all the roles a user are member of and also all my portal urls.
this is the code
{code}
MembershipModule membershipModule = (MembershipModule) new InitialContext().lookup("java:portal/MembershipModule
Iterator iterator = membershipModule.getRoles(request.getUser()).iterator();
//displays all roles the user are member of
while (iterator.hasNext()) {
html.write("these are your roles, " + iterator.next().toString() + "<br />");
}
//this code part will display links for all the portals
PortalNode pn= request.getPortalNode().getRoot();
for(Object objPage : pn.getChildren()){
if(objPage instanceof PortalNode){
PortalNode page = (PortalNode)objPage;
if(page.getType() == PortalNode.TYPE_PORTAL){
PortalNode childPN= page.getChild("default");
PortalNodeURL pURL = response.createRenderURL(childPN);
html.write("<a href=\"" + pURL + "\">" +page.getDisplayName(request.getLocale()) + "</a><br/>");
}
}
}
{code}
I have tried the bellow code but got Null pointer exception at authorizationDomainRegistry.getDomain(); any idead?{code}
AuthorizationDomain authorizationDomain= authorizationDomainRegistry.getDomain(pnu.toString());// also tried with pURL.toString()
PermissionRepository pr= authorizationDomain.getPermissionRepository();
Iterator i= membershipModule.getRoles(request.getUser()).iterator();
while (i.hasNext()) {
PortalPermission portalPermission = pr.getPermission(iterator.next().toString(), pURL.toString());
//haven't started to code this part..
{code}
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/522521#522521
More information about the jboss-user
mailing list