You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2008/10/06 13:13:39 UTC

svn commit: r702099 - in /portals/jetspeed-2/portal/branches/security-refactoring: components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/ jetspeed-api/src/main/java/org/apache/jetspeed/security/

Author: ate
Date: Mon Oct  6 04:13:38 2008
New Revision: 702099

URL: http://svn.apache.org/viewvc?rev=702099&view=rev
Log:
- Add common interface PrincipalTypeManager to be extended by all *custom* PrincipalManager interfaces to allow full access to the underlying JetspeedPrincipalManager
- Add dedicated GroupToGroup and RoleToRole hierarchical association methods

Added:
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java   (with props)
Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/GroupManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/RoleManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java?rev=702099&r1=702098&r2=702099&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java Mon Oct  6 04:13:38 2008
@@ -27,6 +27,7 @@
 import org.apache.jetspeed.security.JetspeedPrincipal;
 import org.apache.jetspeed.security.JetspeedPrincipalAssociationReference;
 import org.apache.jetspeed.security.JetspeedPrincipalAssociationType;
+import org.apache.jetspeed.security.JetspeedPrincipalManager;
 import org.apache.jetspeed.security.JetspeedPrincipalManagerProvider;
 import org.apache.jetspeed.security.JetspeedPrincipalType;
 import org.apache.jetspeed.security.SecurityException;
@@ -131,6 +132,11 @@
         return principalType;
     }
     
+    public final JetspeedPrincipalManager getPrincipalManager()
+    {
+        return this;
+    }
+    
     public List<JetspeedPrincipalAssociationType> getAssociationTypes()
     {
         return Collections.unmodifiableList(associationTypes);
@@ -176,8 +182,7 @@
     {
         if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, from.getName(), principalType.getName())))
         {
-            // TODO: should we throw an exception here???
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         return jpam.getAssociatedFrom(principalFromName, from, principalType, associationName);
     }
@@ -186,8 +191,7 @@
     {
         if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, from.getName(), principalType.getName())))
         {
-            // TODO: should we throw an exception here???
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         return jpam.getAssociatedNamesFrom(principalFromName, from, principalType, associationName);
     }
@@ -196,8 +200,7 @@
     {
         if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, principalType.getName(), to.getName())))
         {
-            // TODO: should we throw an exception here???
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         return jpam.getAssociatedNamesTo(principalToName, principalType, to, associationName);
     }
@@ -206,8 +209,7 @@
     {
         if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, principalType.getName(), to.getName())))
         {
-            // TODO: should we throw an exception here???
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         return jpam.getAssociatedTo(principalToName, principalType, to, associationName);
     }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java?rev=702099&r1=702098&r2=702099&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java Mon Oct  6 04:13:38 2008
@@ -149,6 +149,7 @@
     /**
      * @see org.apache.jetspeed.security.GroupManager#getGroupsForUser(java.lang.String)
      */
+    @SuppressWarnings("unchecked")
     public List<Group> getGroupsForUser(String username)
             throws SecurityException
     {
@@ -158,6 +159,7 @@
     /**
      * @see org.apache.jetspeed.security.GroupManager#getGroupsInRole(java.lang.String)
      */
+    @SuppressWarnings("unchecked")
     public List<Group> getGroupsInRole(String roleName)
             throws SecurityException
     {
@@ -213,12 +215,13 @@
     public boolean isUserInGroup(String username, String groupName)
             throws SecurityException
     {
-        return getGroupsForUser(username).contains(getGroup(groupName));
+        return getAssociatedNamesFrom(username, userType, JetspeedPrincipalAssociationType.IS_MEMBER_OF).contains(groupName);
     }
 
     /**
      * @see org.apache.jetspeed.security.GroupManager#getGroups(java.lang.String)
      */
+    @SuppressWarnings("unchecked")
     public List<Group> getGroups(String nameFilter) throws SecurityException
     {
         return (List<Group>) super.getPrincipals(nameFilter);
@@ -237,6 +240,40 @@
         super.updatePrincipal(group);
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.GroupManager#addGroupToGroup(org.apache.jetspeed.security.Group, org.apache.jetspeed.security.Group, java.lang.String)
+     */
+    public void addGroupToGroup(Group from, Group to, String associationName) throws SecurityException
+    {
+        this.addAssociation(from, to, associationName);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.GroupManager#removeGroupFromGroup(org.apache.jetspeed.security.Group, org.apache.jetspeed.security.Group, java.lang.String)
+     */
+    public void removeGroupFromGroup(Group from, Group to, String associationName) throws SecurityException
+    {
+        removeAssociation(from, to, associationName);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.GroupManager#getGroupsAssociatedFrom(org.apache.jetspeed.security.Group, java.lang.String)
+     */
+    @SuppressWarnings("unchecked")
+    public List<Group> getGroupsAssociatedFrom(Group from, String associationName)
+    {
+        return (List<Group>)getAssociatedFrom(from.getName(), from.getType(), associationName);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.GroupManager#getGroupsAssociatedTo(org.apache.jetspeed.security.Group, java.lang.String)
+     */
+    @SuppressWarnings("unchecked")
+    public List<Group> getGroupsAssociatedTo(Group to, String associationName)
+    {
+        return (List<Group>)getAssociatedFrom(to.getName(), to.getType(), associationName);
+    }
+    
     public JetspeedPrincipal newPrincipal(String name, boolean mapped)
     {
         return newGroup(name, mapped);

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java?rev=702099&r1=702098&r2=702099&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java Mon Oct  6 04:13:38 2008
@@ -157,6 +157,7 @@
     /**
      * @see org.apache.jetspeed.security.RoleManager#getRolesForUser(java.lang.String)
      */
+    @SuppressWarnings("unchecked")
     public List<Role> getRolesForUser(String username) throws SecurityException
     {        
         return (List<Role>)super.getAssociatedFrom(username, userType, JetspeedPrincipalAssociationType.IS_MEMBER_OF);
@@ -165,6 +166,7 @@
     /**
      * @see org.apache.jetspeed.security.RoleManager#getRolesInGroup(java.lang.String)
      */
+    @SuppressWarnings("unchecked")
     public List<Role> getRolesInGroup(String groupName) throws SecurityException
     {
         return (List<Role>)super.getAssociatedFrom(groupName, groupType, JetspeedPrincipalAssociationType.IS_MEMBER_OF);
@@ -216,7 +218,7 @@
      */
     public boolean isUserInRole(String username, String roleName) throws SecurityException
     {
-        return getRolesForUser(username).contains(getRole(roleName));
+        return getAssociatedNamesFrom(username, userType, JetspeedPrincipalAssociationType.IS_MEMBER_OF).contains(roleName);
     }
 
     /**
@@ -265,12 +267,13 @@
      */
     public boolean isGroupInRole(String groupName, String roleName) throws SecurityException
     {
-        return getRolesInGroup(groupName).contains(getRole(roleName));
+        return getAssociatedNamesFrom(groupName, groupType, JetspeedPrincipalAssociationType.IS_MEMBER_OF).contains(roleName);
     }
 
     /**
      * @see org.apache.jetspeed.security.RoleManager#getRoles(java.lang.String)
      */
+    @SuppressWarnings("unchecked")
     public List<Role> getRoles(String nameFilter) throws SecurityException
     {
         return (List<Role>)super.getPrincipals(nameFilter);
@@ -288,7 +291,41 @@
     {
          super.updatePrincipal(role);
     }
-
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.RoleManager#addRoleToRole(org.apache.jetspeed.security.Role, org.apache.jetspeed.security.Role, java.lang.String)
+     */
+    public void addRoleToRole(Role from, Role to, String associationName) throws SecurityException
+    {
+        this.addAssociation(from, to, associationName);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.RoleManager#removeRoleFromRole(org.apache.jetspeed.security.Role, org.apache.jetspeed.security.Role, java.lang.String)
+     */
+    public void removeRoleFromRole(Role from, Role to, String associationName) throws SecurityException
+    {
+        removeAssociation(from, to, associationName);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.RoleManager#getRolesAssociatedFrom(org.apache.jetspeed.security.Role, java.lang.String)
+     */
+    @SuppressWarnings("unchecked")
+    public List<Role> getRolesAssociatedFrom(Role from, String associationName)
+    {
+        return (List<Role>)getAssociatedFrom(from.getName(), from.getType(), associationName);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.security.RoleManager#getRolesAssociatedTo(org.apache.jetspeed.security.Role, java.lang.String)
+     */
+    @SuppressWarnings("unchecked")
+    public List<Role> getRolesAssociatedTo(Role to, String associationName)
+    {
+        return (List<Role>)getAssociatedFrom(to.getName(), to.getType(), associationName);
+    }
+    
     /* (non-Javadoc)
      * @see org.apache.jetspeed.security.JetspeedPrincipalManager#newPrincipal(java.lang.String, boolean)
      */

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/GroupManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/GroupManager.java?rev=702099&r1=702098&r2=702099&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/GroupManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/GroupManager.java Mon Oct  6 04:13:38 2008
@@ -23,10 +23,9 @@
  * Describes the service interface for managing groups.
  * </p>
  * 
- * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
  * @version $Id$
  */
-public interface GroupManager
+public interface GroupManager extends PrincipalTypeManager
 {
     Group newGroup(String name, boolean mapped);
     Group newTransientGroup(String name);
@@ -167,4 +166,86 @@
     * @throws SecurityException
     */
    void updateGroup(Group group) throws SecurityException;
+
+   /**
+    * Add a hierarchical association between two groups.
+    * <p>
+    * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+    * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+    * if the required {@link JetspeedPrincipalAssociationType} is available.
+    * </p>
+    * @param from The group for the from side of the association 
+    * @param to The group for the to side of the association
+    * @param associationName The name of the {@link JetspeedAssociationType} to create
+    * @throws SecurityException
+    */
+   void addGroupToGroup(Group from, Group to, String associationName) throws SecurityException;
+
+   /**
+    * Remove a hierarchical association between two groups.
+    * <p>
+    * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+    * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+    * if the required {@link JetspeedPrincipalAssociationType} is available.
+    * </p>
+    * @param from The group for the from side of the association 
+    * @param to The group for the to side of the association
+    * @param associationName The name of the {@link JetspeedAssociationType} to create
+    * @throws SecurityException
+    */
+   void removeGroupFromGroup(Group from, Group to, String associationName) throws SecurityException;
+   
+   /**
+    * Retrieve all the groups which are associated <em>to</em> the provided group. 
+    * <p>
+    * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+    * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+    * if the required {@link JetspeedPrincipalAssociationType} is available.
+    * </p>
+     * <p>
+     * If the corresponding {@link JetspeedPrincipalAssociationType} is not available, this method will simply
+     * return a empty list.
+     * </p>
+    * <p>
+    * For a {@link JetspeedPrincipalAssociationType#IS_PART_OF} association, this will return all
+    * the nested groups which together <em>represent</em> the provided group.
+    * </p>
+    * <p>
+    * For a {@link JetspeedPrincipalAssociationType#IS_A} association, this will return all
+    * the groups which <em>extend</em> the provided group.
+    * </p>
+    * <p>
+    * Note: this method will only return the directly associated groups, not further derived associations.
+    * </p>
+    * @param to The group for the to side of the association
+    * @param associationName The name of the {@link JetspeedAssociationType} to create
+    */
+   List<Group> getGroupsAssociatedTo(Group to, String associationName);
+
+   /**
+    * Retrieve all the groups which are associated <em>from</em> the provided group. 
+    * <p>
+    * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+    * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+    * if the required {@link JetspeedPrincipalAssociationType} is available.
+    * </p>
+     * <p>
+     * If the corresponding {@link JetspeedPrincipalAssociationType} is not available, this method will simply
+     * return a empty list.
+     * </p>
+    * <p>
+    * For a {@link JetspeedPrincipalAssociationType#IS_PART_OF} association, this will return (at most)
+    * the single group where the provided group is part of.
+    * </p>
+    * <p>
+    * For a {@link JetspeedPrincipalAssociationType#IS_A} association, this will return all
+    * the groups which the provided group <em>extends</em>.
+    * </p>
+    * <p>
+    * Note: this method will only return the directly associated group(s), not further derived associations.
+    * </p>
+    * @param from The group for the from side of the association 
+    * @param associationName The name of the {@link JetspeedAssociationType} to create
+    */
+   List<Group> getGroupsAssociatedFrom(Group from, String associationName);
 }
\ No newline at end of file

Added: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java?rev=702099&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java Mon Oct  6 04:13:38 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.security;
+
+/**
+ * @version $Id$
+ *
+ */
+public interface PrincipalTypeManager
+{
+    JetspeedPrincipalType getPrincipalType();
+    JetspeedPrincipalManager getPrincipalManager();
+}

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalTypeManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/RoleManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/RoleManager.java?rev=702099&r1=702098&r2=702099&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/RoleManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/RoleManager.java Mon Oct  6 04:13:38 2008
@@ -20,10 +20,9 @@
 
 /**
  * <p>Describes the service interface for managing roles.</p>
- * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
  * @version $Id$
  */
-public interface RoleManager
+public interface RoleManager extends PrincipalTypeManager
 {
     Role newRole(String name, boolean mapped);
     Role newTransientRole(String name);
@@ -170,4 +169,86 @@
      * @throws SecurityException
      */
     void updateRole(Role role) throws SecurityException;
+    
+    /**
+     * Add a hierarchical association between two roles.
+     * <p>
+     * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+     * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+     * if the required {@link JetspeedPrincipalAssociationType} is available.
+     * </p>
+     * @param from The role for the from side of the association 
+     * @param to The role for the to side of the association
+     * @param associationName The name of the {@link JetspeedAssociationType} to create
+     * @throws SecurityException
+     */
+    void addRoleToRole(Role from, Role to, String associationName) throws SecurityException;
+
+    /**
+     * Remove a hierarchical association between two roles.
+     * <p>
+     * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+     * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+     * if the required {@link JetspeedPrincipalAssociationType} is available.
+     * </p>
+     * @param from The role for the from side of the association 
+     * @param to The role for the to side of the association
+     * @param associationName The name of the {@link JetspeedAssociationType} to create
+     * @throws SecurityException
+     */
+    void removeRoleFromRole(Role from, Role to, String associationName) throws SecurityException;
+    
+    /**
+     * Retrieve all the roles which are associated <em>to</em> the provided role. 
+     * <p>
+     * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+     * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+     * if the required {@link JetspeedPrincipalAssociationType} is available.
+     * </p>
+     * <p>
+     * If the corresponding {@link JetspeedPrincipalAssociationType} is not available, this method will simply
+     * return a empty list.
+     * </p>
+     * <p>
+     * For a {@link JetspeedPrincipalAssociationType#IS_PART_OF} association, this will return all
+     * the nested roles which together <em>represent</em> the provided role.
+     * </p>
+     * <p>
+     * For a {@link JetspeedPrincipalAssociationType#IS_A} association, this will return all
+     * the roles which <em>extend</em> the provided role.
+     * </p>
+     * <p>
+     * Note: this method will only return the directly associated roles, not further derived associations.
+     * </p>
+     * @param to The role for the to side of the association
+     * @param associationName The name of the {@link JetspeedAssociationType} to create
+     */
+    List<Role> getRolesAssociatedTo(Role to, String associationName);
+
+    /**
+     * Retrieve all the roles which are associated <em>from</em> the provided role. 
+     * <p>
+     * Default supported hierarchical associations are {@link JetspeedPrincipalAssociationType#IS_A} and
+     * {@link JetspeedPrincipalAssociationType#IS_PART_OF}, but it will depend on the actual runtime configuration
+     * if the required {@link JetspeedPrincipalAssociationType} is available.
+     * </p>
+     * <p>
+     * If the corresponding {@link JetspeedPrincipalAssociationType} is not available, this method will simply
+     * return a empty list.
+     * </p>
+     * <p>
+     * For a {@link JetspeedPrincipalAssociationType#IS_PART_OF} association, this will return (at most)
+     * the single role where the provided role is part of.
+     * </p>
+     * <p>
+     * For a {@link JetspeedPrincipalAssociationType#IS_A} association, this will return all
+     * the roles which the provided role <em>extends</em>.
+     * </p>
+     * <p>
+     * Note: this method will only return the directly associated role(s), not further derived associations.
+     * </p>
+     * @param from The role for the from side of the association 
+     * @param associationName The name of the {@link JetspeedAssociationType} to create
+     */
+    List<Role> getRolesAssociatedFrom(Role from, String associationName);
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java?rev=702099&r1=702098&r2=702099&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java Mon Oct  6 04:13:38 2008
@@ -27,10 +27,9 @@
  * {@link User}.
  * </p>
  * 
- * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
  * @version $Id$
  */
-public interface UserManager
+public interface UserManager extends PrincipalTypeManager
 {
     /**
      * @return the name of the anonymous user



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