This project has retired. For details please refer to its Attic page.
UserAssignment xref
View Javadoc

1   package org.apache.archiva.redback.rbac;
2   
3   import java.util.List;
4   
5   /*
6    * Copyright 2001-2006 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  /**
22   * UserAssignment - This the mapping object that takes the principal for a user and associates it with a
23   * set of Roles.
24   * 
25   * This is the many to many mapping object needed by persistence stores.
26   *
27   * @author Jesse McConnell <jmcconnell@apache.org>
28   * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
29   *
30   * @todo expand on javadoc
31   */
32  public interface UserAssignment
33  {
34  
35      
36      /**
37       * The principal for the User that the set of roles is associated with.
38       * 
39       * NOTE: This field is considered the Primary Key for this object.
40       * 
41       * @return the principal for the User.
42       */
43      String getPrincipal();
44  
45      /**
46       * Get the roles for this user.
47       * 
48       * @return List of &lt;{@link String}&gt; objects representing the Role Names.
49       */
50      List<String> getRoleNames();
51      
52      /**
53       * Add a rolename to this assignment.
54       * 
55       * @param role the role.
56       */
57      void addRoleName( Role role );
58      
59      /**
60       * Add a rolename to this assignment.
61       * 
62       * @param roleName the role name.
63       */
64      void addRoleName( String roleName );
65      
66      /**
67       * Remove a rolename from this assignment.
68       * 
69       * @param role the role who's name is to be removed.
70       */
71      void removeRoleName( Role role );
72      
73      /**
74       * Remove a role name from this assignment.
75       * 
76       * @param roleName the role name to be removed.
77       */
78      void removeRoleName( String roleName );
79  
80      /**
81       * Set the user principal object for this association.
82       * 
83       * NOTE: This field is considered the Primary Key for this object.
84       * 
85       * @param principal
86       */
87      void setPrincipal( String principal );
88  
89      /**
90       * Set the roles names for this user.
91       * 
92       * @param roles the List of &lt;{@link String}&gt; objects representing the Role Names.
93       */
94      void setRoleNames( List<String> roles );
95      
96      /**
97       * Test to see if the object is a permanent object or not.
98       * 
99       * @return true if the object is permanent.
100      */
101     boolean isPermanent();
102 
103     /**
104      * Set flag indicating if the object is a permanent object or not.
105      * 
106      * @param permanent true if the object is permanent.
107      */
108     void setPermanent( boolean permanent );
109 }