[jboss-user] [JBoss Portal] New message: "Re: Portlet that lists all available portals for a user"
vineet tripathi
do-not-reply at jboss.com
Tue Jan 26 06:24:23 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/522258#522258
Author : vineet tripathi
Profile : http://community.jboss.org/people/vineet_tripathi
Message:
--------------------------------------------------------------
Approach 1 -
When you create a portal and assign it the security to be viewed by a role or set or roles, that information is persisted in JBP_OBJECT_NODE_SEC, table of jboss portal schema. This table has 3 columns, PK, ROLE, NODE_KEY. If you query this table and group by role you will get the primary keys of all the portals to which a role is having access.
Once you have got the primary key of portals you can access JBP_OBJECT_NODE table to get the name of portals and construct the URLs to them.
Now, All the things that I mentioned above have few cons
1- The table JBP_OBJECT_NODE_SEC is not indexed on ROLE, So if your number of portals will grow you will face performance problem
2- There are portal services to get this information and probably accessing the tables directly will not be a good approach in long term(what if portal schema changes).
Approach 2-
1- Find all the Portals created. You can find the context and then get all the children of context to get a list of all the portals.
To find ur current node
PortalNode root = (PortalNode)request.getAttribute("org.jboss.portal.api.PORTAL_NODE");
PortalNode portal = root;
while (portal.getType() != PortalNode.TYPE_CONTEXT)
{
mainPage = portal;
portal = portal.getParent();
}
portal.getChildren();
configurator
2- get the domain (see the reference guide) and get the uri for each node
3- Find the RoleSecurityBinding associated with each portal
4- use the getRoleName() to determine that to which role the securtiy binding is asscoiated:
RoleSecurityBinding roleSecurityBinding = getDomainConfigurator().getSecurityBindings(uri);
roleSecurityBinding.getRoleName() ;
Let us (everyone in the forum) know ur thoughts and how u finally did it (if you have something else in your mind).
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/522258#522258
More information about the jboss-user
mailing list