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/09/07 16:02:54 UTC

svn commit: r692860 - in /portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security: GroupManager.java RoleManager.java UserManager.java

Author: ate
Date: Sun Sep  7 07:02:53 2008
New Revision: 692860

URL: http://svn.apache.org/viewvc?rev=692860&view=rev
Log:
API clean up:
- replace Collection<T> return types with List<T> 
- remove all description and referencing of nested/full path naming of roles and groups which is no longer available/used (replaced with associations)

Modified:
    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/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=692860&r1=692859&r2=692860&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 Sun Sep  7 07:02:53 2008
@@ -16,22 +16,12 @@
  */
 package org.apache.jetspeed.security;
 
-import java.util.Collection;
+import java.util.List;
 
 /**
  * <p>
  * Describes the service interface for managing groups.
  * </p>
- * <p>
- * Group hierarchy elements are being returned as a {@link Group}collection.
- * The backing implementation must appropriately map the group hierarchy to a
- * preferences sub-tree.
- * </p>
- * <p>
- * The convention {principal}.{subprincipal} has been chosen to name groups
- * hierachies. Implementation follow the conventions enforced by the Preferences
- * API.
- * </p>
  * 
  * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
  * @version $Id$
@@ -45,84 +35,61 @@
      * <p>
      * Add a new group.
      * </p>
-     * <p>
-     * Group principal names are expressed as {principal}.{subprincipal} where
-     * "." is the separator expressing the hierarchical nature of a group.
-     * </p>
-     * <p>
-     * Group principal path names are stored leveraging the {@link Preferences}
-     * api. Groups will be stored under /group/theGroupName/theGroupNameChild
-     * when given the full path name theGroupName.theGroupNameChild.
-     * 
-     * @param groupFullPathName The group name full path (e.g.
-     *            theGroupName.theGroupNameChild).
+     * @param groupName The group name
      * @throws Throws a security exception.
      */
-    void addGroup(String groupFullPathName) throws SecurityException;
+    void addGroup(String groupName) throws SecurityException;
 
     /**
      * <p>
      * Remove a group.
      * </p>
-     * <p>
-     * Group principal names are expressed as {principal}.{subprincipal} where
-     * "." is the separator expressing the hierarchical nature of a group.
-     * </p>
-     * <p>
-     * Group principal path names are stored leveraging the {@link Preferences}
-     * api. Groups will be stored under /group/theGroupName/theGroupNameChild
-     * when given the full path name theGroupName.theGroupNameChild.
-     * 
-     * @param groupFullPathName The group name full path (e.g.
-     *            theGroupName.theGroupNameChild)
+     * @param groupName The group name
      * @throws Throws a security exception.
      */
-    void removeGroup(String groupFullPathName) throws SecurityException;
+    void removeGroup(String groupName) throws SecurityException;
 
     /**
      * <p>
      * Whether or not a group exists.
      * </p>
      * 
-     * @param groupFullPathName The group name full path (e.g.
-     *            theGroupName.theGroupNameChild)
+     * @param groupName The group name
      * @return Whether or not a group exists.
      */
-    boolean groupExists(String groupFullPathName);
+    boolean groupExists(String groupName);
 
     /**
      * <p>
-     * Get a group {@link Group}for a given group full path name.
+     * Get a group {@link Group}for a given group name.
      * 
-     * @param groupFullPathName The group name full path (e.g.
-     *            theGroupName.theGroupChildName).
-     * @return The {@link Preferences}node.
+     * @param groupName
+     * @return The {@link Group}
      * @throws Throws security exception if the group does not exist.
      */
-    Group getGroup(String groupFullPathName) throws SecurityException;
+    Group getGroup(String groupName) throws SecurityException;
 
     /**
      * <p>
-     * A collection of {@link Group}for all the groups associated to a specific
+     * Retrieves a {@link Group} list of all the groups associated to a specific
      * user.
      * 
      * @param username The user name.
-     * @return A collection of {@link Group}.
+     * @return A list of {@link Group}.
      * @throws Throws security exception if the user does not exist.
      */
-    Collection<Group> getGroupsForUser(String username) throws SecurityException;
+    List<Group> getGroupsForUser(String username) throws SecurityException;
 
     /**
      * <p>
-     * A collection of {@link Group}for all the groups in a specific role.
+     * Retrieves {@link Group} list of all the groups in a specific role.
      * </p>
      * 
-     * @param roleFullPathName The role full path (e.g.
-     *            theRoleName.theRoleChildName)..
-     * @return A Collection of {@link Group}.
+     * @param roleName The role name
+     * @return A list of {@link Group}.
      * @throws Throws a security exception if the role does not exist.
      */
-    Collection<Group> getGroupsInRole(String roleFullPathName) throws SecurityException;
+    List<Group> getGroupsInRole(String roleName) throws SecurityException;
 
     /**
      * <p>
@@ -130,11 +97,10 @@
      * </p>
      * 
      * @param username The user name.
-     * @param groupFullPathName The group name full path (e.g.
-     *            theGroupName.theGroupChildName).
+     * @param groupName The group name
      * @throws Throws a security exception.
      */
-    void addUserToGroup(String username, String groupFullPathName) throws SecurityException;
+    void addUserToGroup(String username, String groupName) throws SecurityException;
 
     /**
      * <p>
@@ -142,11 +108,10 @@
      * </p>
      * 
      * @param username The user name.
-     * @param groupFullPathName The group name full path (e.g.
-     *            theGroupName.theGroupChildName).
+     * @param groupName The group name
      * @throws Throws a security exception.
      */
-    void removeUserFromGroup(String username, String groupFullPathName) throws SecurityException;
+    void removeUserFromGroup(String username, String groupName) throws SecurityException;
 
     /**
      * <p>
@@ -154,25 +119,25 @@
      * </p>
      * 
      * @param username The user name.
-     * @param groupFullPathName The group name full path (e.g.
-     *            theGroupName.theGroupChildName).
+     * @param groupName The group name
      * @return Whether or not a user is in a group.
      * @throws Throws security exception if the user or group does not exist.
      */
-    boolean isUserInGroup(String username, String groupFullPathName) throws SecurityException;
+    boolean isUserInGroup(String username, String groupName) throws SecurityException;
 
     /**
-     * Get all groups available from all group handlers
+     * Retrieves a {@link Group} list matching the corresponding
+     * group name filter.
+     * </p>
      * 
-     * @param filter The filter used to retrieve matching groups.
-     * @return all groups available as Group 
+     * @param nameFilter The filter used to retrieve matching groups.
+     * @return a list of {@link Group} 
      */
-   Collection<Group> getGroups(String filter) throws SecurityException;
+   List<Group> getGroups(String nameFilter) throws SecurityException;
     
    /**
     * Enable or disable a group.
-    * @param groupName The group name full path 
-     *            theGroupName.theGroupChildName).
+    * @param groupName The group name
     * @param enabled enabled flag for the group
     */
    void setGroupEnabled(String groupName, boolean enabled) throws SecurityException;

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=692860&r1=692859&r2=692860&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 Sun Sep  7 07:02:53 2008
@@ -16,19 +16,12 @@
  */
 package org.apache.jetspeed.security;
 
-import java.util.Collection;
 import java.util.List;
-import java.util.prefs.Preferences;
 
 /**
  * <p>Describes the service interface for managing roles.</p>
- * <p>Role hierarchy elements are being returned as a {@link Role}
- * collection.  The backing implementation must appropriately map 
- * the role hierarchy to a preferences sub-tree.</p> 
- * <p>The convention {principal}.{subprincipal} has been chosen to name
- * roles hierachies in order to support declarative security.  Implementation
- * follow the conventions enforced by the preferences API.</p>
  * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ * @version $Id$
  */
 public interface RoleManager
 {
@@ -37,138 +30,115 @@
     
     /**
      * <p>Add a new role.</p>
-     * <p>Role principal names are expressed as {principal}.{subprincipal} where
-     * "." is the separator expressing the hierarchical nature of a role.</p>
-     * <p>Role principal path names are stored leveraging the {@link Preferences}
-     * api.  Roles will be stored under /role/theGroupName/theGroupNameChild
-     * when given the full path name theRoleName.theRoleNameChild.
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleNameChild).
+     * @param roleName The role name
      * @throws Throws a security exception if the role already exists.
      */
-    void addRole(String roleFullPathName) throws SecurityException;
+    void addRole(String roleName) throws SecurityException;
 
     /**
-     * <p>Remove a given role and all the children of that role.</p>
-     * <p>Role principal names are expressed as {principal}.{subprincipal} where
-     * "." is the separator expressing the hierarchical nature of a role.</p>
-     * <p>Role principal path names are stored leveraging the {@link Preferences}
-     * api.  Roles will be stored under /role/theGroupName/theGroupNameChild
-     * when given the full path name theRoleName.theRoleNameChild.
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleNameChild).
+     * <p>Remove a given role</p>
+     * @param roleName
      * @throws Throws a security exception.
      */
-    void removeRole(String roleFullPathName) throws SecurityException;
+    void removeRole(String roleName) throws SecurityException;
 
     /**
      * <p>Whether or not a role exists.</p>
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleNameChild).
+     * @param roleName 
      * @return Whether or not a role exists.
      */
-    boolean roleExists(String roleFullPathName);
+    boolean roleExists(String roleName);
 
     /**
-     * <p>Get a role {@link Role} for a given role full path name.
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleNameChild).
-     * @return The {@link Preferences} node.
+     * <p>Get a role {@link Role} for a given role name.
+     * @param roleName The role name
+     * @return The {@link Role}.
      * @throws Throws a security exception if the role does not exist.
      */
-    Role getRole(String roleFullPathName) throws SecurityException;
+    Role getRole(String roleName) throws SecurityException;
 
     /**
-     * <p>A list of {@link Role} for all the roles
+     * <p>Retrieves a {@link Role} list of all the roles
      * associated to a specific user.</p>
      * @param username The user name.
-     * @return A Collection of {@link Role}.
+     * @return A List of {@link Role}.
      * @throws Throws a security exception if the user does not exist.
      */
     List<Role> getRolesForUser(String username) throws SecurityException;
 
     /**
-     * <p>A list of {@link Role} for all the roles
+     * <p>Retrieves a {@link Role} list of all the roles
      * associated to a specific group.</p>
-     * @param groupFullPathName The group full path
-     *                          (e.g. theGroupName.theGroupChildName).
+     * @param groupName The group name
      * @return A Collection of {@link Role}.
      * @throws Throws a security exception if the group does not exist.
      */
-    List<Role> getRolesInGroup(String groupFullPathName) throws SecurityException;
+    List<Role> getRolesInGroup(String groupName) throws SecurityException;
     
     /**
      * <p>Add a role to a user.</p>
-     * @param username The user name.
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleChildName).
+     * @param username The user name
+     * @param roleName The role name
      * @throws Throws a security exception if the role or the user do not exist.
      */
-    void addRoleToUser(String username, String roleFullPathName) throws SecurityException;
+    void addRoleToUser(String username, String roleName) throws SecurityException;
 
     /**
      * <p>Remove a user from a role.</p>
      * @param username The user name.
-     * @param roleFullPathName The role name full path relative to the
-     *                         /role node (e.g. /theRoleName/theRoleChildName).
+     * @param roleName The role name
      * @throws Throws a security exception.
      */
-    void removeRoleFromUser(String username, String roleFullPathName) throws SecurityException;
+    void removeRoleFromUser(String username, String roleName) throws SecurityException;
 
     /**
      * <p>Whether or not a user is in a role.</p>
      * @param username The user name.
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleChildName).
+     * @param roleName The role name 
      * @return Whether or not a user is in a role.
      * @throws Throws a security exception if the role or the user does not exist.
      */
-    boolean isUserInRole(String username, String roleFullPathName) throws SecurityException;
+    boolean isUserInRole(String username, String roleName) throws SecurityException;
 
     /**
      * <p>Add a role to a group.</p>
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleChildName).
-     * @param groupFullPathName The group name full path
-     *                          (e.g. theGroupName.theGroupChildName).
+     * @param roleName The role name
+     * @param groupName The group name 
      * @throws Throws a security exception.
      */
-    void addRoleToGroup(String roleFullPathName, String groupFullPathName) throws SecurityException;
+    void addRoleToGroup(String roleName, String groupName) throws SecurityException;
 
     /**
      * <p>Remove a role from a group.</p>
-     * @param roleFullPathName The role name full path 
-     *                         (e.g. theRoleName.theRoleChildName).
-     * @param groupFullPathName The group name full path
-     *                          (e.g. theGroupName.theGroupChildName).
+     * @param roleName The role name
+     * @param groupName The group name
      * @throws Throws a security exception.
      */
-    void removeRoleFromGroup(String roleFullPathName, String groupFullPathName) throws SecurityException;
+    void removeRoleFromGroup(String roleName, String groupName) throws SecurityException;
 
     /**
      * <p>Whether or not a role is in a group.</p>
-     * @param groupFullPathName The group name full path
-     *                          (e.g. theGroupName.theGroupChildName).
-     * @param roleFullPathName The role name full path
-     *                         (e.g. theRoleName.theRoleChildName).
+     * @param groupName The group name
+     * @param roleName The role name
      * @return Whether or not a role is in a group.
      * @throws Throws a security exception if the role or the group does not exist.
      */
-    boolean isGroupInRole(String groupFullPathName, String roleFullPathName) throws SecurityException;
+    boolean isGroupInRole(String groupName, String roleName) throws SecurityException;
 
     /**
-     * Get all roles available from all role handlers
+     * Retrieves a {@link Role} list matching the corresponding
+     * role name filter.
+     * </p>
      * 
-     * @param filter The filter used to retrieve matching roles.
-     * @return all roles available as Role 
+     * @param nameFilter The filter used to retrieve matching roles.
+     * @return a list of {@link Role} 
      */
-    Collection<Role> getRoles(String filter) throws SecurityException;
+    List<Role> getRoles(String nameFilter) throws SecurityException;
     
     /**
      * Enable or disable a role.
-     * @param roleFullPathName The role name full path 
-     *                         (e.g. theRoleName.theRoleChildName).
+     * @param roleName.
      * @param enabled enabled flag for the role
      */
-    void setRoleEnabled(String roleFullPathName, boolean enabled) throws SecurityException;
+    void setRoleEnabled(String roleName, boolean enabled) throws SecurityException;
 }

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=692860&r1=692859&r2=692860&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 Sun Sep  7 07:02:53 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.jetspeed.security;
 
-import java.util.Collection;
 import java.util.List;
 
 import javax.security.auth.Subject;
@@ -30,6 +29,7 @@
  * </p>
  * 
  * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
+ * @version $Id$
  */
 public interface UserManager
 {
@@ -142,48 +142,44 @@
 
     /**
      * <p>
-     * An iterator of {@link User}finding users matching the corresponding
-     * filter criteria.
+     * Retrieves a {@link User} list matching the corresponding
+     * user name filter.
      * </p>
-     * TODO Complete filter implementation.
      * 
-     * @param filter The filter used to retrieve matching users.
-     * @return a collection of {@link User}.
+     * @param nameFilter The filter used to retrieve matching users.
+     * @return a list of {@link User}.
      */
-    Collection<User> getUsers(String filter) throws SecurityException;
+    List<User> getUsers(String nameFilter) throws SecurityException;
 
     /**
      * <p>
-     * An iterator of user names, finding users matching the corresponding
-     * filter criteria.
+     * Retrieves a List user names, finding users matching the corresponding
+     * user name filter.
      * </p>
-     * TODO Complete filter implementation.
      * 
-     * @param filter The filter used to retrieve matching users.
-     * @return A list of user name strings
+     * @param nameFilter The filter used to retrieve matching users.
+     * @return A list of user names
      */
-    List<String> getUserNames(String filter) throws SecurityException;
+    List<String> getUserNames(String nameFilter) throws SecurityException;
 
     /**
      * <p>
-     * A collection of {@link User}for all the users in a specific role.
+     * Retrieves a {@link User} list of all the users in a specific role.
      * </p>
      * 
-     * @param roleFullPathName The role name full path (e.g.
-     *            theRoleName.theRoleNameChild).
-     * @return A Collection of {@link User}.
+     * @param roleName The role name
+     * @return A List of {@link User}.
      * @throws Throws a security exception if the role does not exist.
      */
-    Collection<User> getUsersInRole(String roleFullPathName) throws SecurityException;
+    List<User> getUsersInRole(String roleName) throws SecurityException;
     
     /**
-     * <p>A collection of {@link User} for a specific group.</p>
-     * @param groupFullPathName The group name full path
-     *                          (e.g. theGroupName.theGroupChildName).
-     * @return A collection of {@link User}.
+     * <p>Retrieves a {@link User} list of all the users in a specific group.</p>
+     * @param groupName The group name
+     * @return A list of {@link User}.
      * @throws Throws security exception if the group does not exist.
      */
-    Collection<User> getUsersInGroup(String groupFullPathName) throws SecurityException;
+    List<User> getUsersInGroup(String groupName) throws SecurityException;
     
     /**
      * Enable or disable a user.
@@ -200,13 +196,13 @@
     void updateUser(User user) throws SecurityException;
     
     /**
-     * Given any attribute name and value, lookup a set of users that match the name value pairs
+     * <p>Retrieves a {@link User} list of all the users having a specific value for a specific attribute
      * @param attributeName
      * @param attributeValue
-     * @return a collection of users
+     * @return a List of users
      * @throws SecurityException
      */
-    Collection<User> lookupUsers(String attributeName, String attributeValue) throws SecurityException;
+    List<User> lookupUsers(String attributeName, String attributeValue) throws SecurityException;
     
     /**
      * Returns the current PasswordCredential for a User or a new one if the doesn't have one yet



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