You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Rajib Das <ra...@anshinsoft.com> on 2003/05/08 12:08:09 UTC

user and role

How the security user, group and role is related to jetspeed user, group
and role ?

I can see there are two schema -dbpsml-schema ans turbine security scema
.

 

Thanking in advance

 

Rajib

 


Re: user and role

Posted by Ivan <li...@yahoo.com>.
>How the security user, group and role is related to
>jetspeed user, 
>group
>and role ?

>I can see there are two schema -dbpsml-schema ans
>turbine security 
>scema
>.

 

>Thanking in advance

Hello,
Do you mean how to get the groups where a user is in?

Here I put you a JSP code to get all the users and the
groups where this user is in.

<%@ page import =
"org.apache.jetspeed.services.JetspeedSecurity" %>
<%@ page import =
"org.apache.jetspeed.om.security.Group" %>
<%@ page import =
"org.apache.jetspeed.om.security.JetspeedUser" %>
<%@ page import =
"org.apache.jetspeed.services.security.JetspeedSecurityException"
%>
<%@ page import =
"org.apache.jetspeed.services.security.GroupException"
%>


<%
	try{
		// Get all users
		Iterator users = JetspeedSecurity.getUsers();
	 	while (users.hasNext())
	    {
	        JetspeedUser user = (JetspeedUser)
users.next();
        	String mUser = user.getUserName();
	        try{
	        	// get groups related to this user
			 	Iterator grupos =
JetspeedSecurity.getGroups(user.getUserName());
			 	out.println("Groups where user " +
user.getUserName() + " is in:<br>");
			 	while (grupos.hasNext()){
			 		Group grupo = (Group) grupos.next();
			 		out.println(grupo.getName()+"<br>");
		 		}
			 } catch(GroupException e){
			 		out.println("Error in Jetspeed Group Security: "
+ e.toString());
			 }
			 out.println("<br>");
	    }
	} catch(JetspeedSecurityException e){
		out.println("Error in Jetspeed User Security: " +
e.toString());
	}
%>


Hope this helps.

Iv�n.



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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