taylor      2004/05/10 10:42:37

  Modified:    components/registry/src/java/org/apache/jetspeed/om/servlet/impl
                        SecurityRoleSetImpl.java SecurityRoleImpl.java
               components/registry/src/java repository_registry.xml
  Log:
  patch applied from Ate Douma for web.xml security roles mapping to portal security 
roles

  

  PR:

  Obtained from:

  Submitted by: 

  Reviewed by:  

  CVS: ----------------------------------------------------------------------

  CVS: PR:

  CVS:   If this change addresses a PR in the problem report tracking

  CVS:   database, then enter the PR number(s) here.

  CVS: Obtained from:

  CVS:   If this change has been taken from another system, such as NCSA,

  CVS:   then name the system in this line, otherwise delete it.

  CVS: Submitted by:

  CVS:   If this code has been contributed to Apache by someone else; i.e.,

  CVS:   they sent us a patch or a new module, then include their name/email

  CVS:   address here. If this is your work then delete this line.

  CVS: Reviewed by:

  CVS:   If we are doing pre-commit code reviews and someone else has

  CVS:   reviewed your changes, include their name(s) here.

  CVS:   If you have not had it reviewed then delete this line.

  
  Revision  Changes    Path
  1.2       +12 -6     
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleSetImpl.java
  
  Index: SecurityRoleSetImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleSetImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SecurityRoleSetImpl.java  7 May 2004 20:32:39 -0000       1.1
  +++ SecurityRoleSetImpl.java  10 May 2004 17:42:37 -0000      1.2
  @@ -61,6 +61,9 @@
        * @see 
org.apache.jetspeed.om.common.servlet.MutableSecurityRoleSet#add(org.apache.pluto.om.common.SecurityRole)
        */
       public SecurityRole add(SecurityRole securityRole) {
  +        if ( innerCollection.contains(securityRole)) {
  +            throw new IllegalArgumentException("SecurityRole 
"+securityRole.getRoleName()+" already defined.");
  +        }
           innerCollection.add(securityRole);
           return securityRole;
       }
  @@ -70,10 +73,8 @@
        */
       public boolean add(Object o) {
           SecurityRole role = (SecurityRole) o;
  -        if (innerCollection.contains(o)) {
  -            remove(o);
  -        }
  -        return innerCollection.add(o);
  +        add(role);
  +        return true;
       }
   
       /**
  @@ -89,7 +90,12 @@
        * @see java.util.Collection#addAll(java.util.Collection)
        */
       public boolean addAll(Collection c) {
  -        return innerCollection.addAll(c);
  +        // enforce unique role names in collection by adding them individually
  +        Iterator itr = c.iterator();
  +        while ( itr.hasNext() ) {
  +            add(itr.next());
  +        }
  +        return true;
       }
   
       /**
  
  
  
  1.2       +21 -3     
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleImpl.java
  
  Index: SecurityRoleImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SecurityRoleImpl.java     7 May 2004 20:32:39 -0000       1.1
  +++ SecurityRoleImpl.java     10 May 2004 17:42:37 -0000      1.2
  @@ -28,6 +28,8 @@
    */
   public class SecurityRoleImpl implements SecurityRole, MutableSecurityRole, 
Serializable {
   
  +    protected long webAppId;
  +
       private String description;
   
       private String roleName;
  @@ -62,8 +64,8 @@
       /**
        * @see 
org.apache.jetspeed.om.common.servlet.MutableSecurityRole#setRoleName(java.lang.String)
        */
  -    public void setRoleName(String name) {
  -        this.roleName = name;
  +    public void setRoleName(String roleName) {
  +        this.roleName = roleName;
       }
   
       /**
  @@ -75,5 +77,21 @@
           String securityRole = "[[roleName, " + this.roleName + "], [description, " 
+ this.description + "]]";
           return securityRole;
       }
  +    
  +    /**
  +     * @see java.lang.Object#equals(java.lang.Object)
  +     */
  +    public boolean equals(Object obj) {
  +        if ( obj != null && obj instanceof SecurityRoleImpl ) {
  +            return getRoleName().equals(((SecurityRoleImpl)obj).getRoleName());
  +        }
  +        return false;
  +    }
   
  +    /** 
  +     * @see java.lang.Object#hashCode()
  +     */
  +    public int hashCode() {
  +        return getRoleName().hashCode();
  +    }
   }
  
  
  
  1.17      +48 -0     
jakarta-jetspeed-2/components/registry/src/java/repository_registry.xml
  
  Index: repository_registry.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/repository_registry.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- repository_registry.xml   7 May 2004 13:42:03 -0000       1.16
  +++ repository_registry.xml   10 May 2004 17:42:37 -0000      1.17
  @@ -260,6 +260,16 @@
             <inverse-foreignkey field-ref="parentId"/>
         </collection-descriptor>
        
  +     <collection-descriptor                                                    
  +       name="securityRoles"                                                    
  +       element-class-ref="org.apache.jetspeed.om.servlet.impl.SecurityRoleImpl"
  +       auto-delete="false"                                                     
  +         auto-update = "true"                                                  
  +         auto-retrieve = "true"                                                     
                                                                          
  +     >                                                                         
  +       <inverse-foreignkey field-ref="webAppId"/>                              
  +    </collection-descriptor>                                                   
  +                      
      </class-descriptor>
   
   <!--
  @@ -1367,5 +1377,43 @@
         />
           
      </class-descriptor>
  +   
  +   <!--                                                              
  +   - S E C U R I T Y  R O L E                                        
  +   -->                                                               
  +     <class-descriptor                                               
  +         class="org.apache.jetspeed.om.servlet.impl.SecurityRoleImpl"
  +         proxy="dynamic"                                             
  +         table="SECURITY_ROLE"                                       
  +   >                                                                 
  +        <field-descriptor                                            
  +         name="id"                                                   
  +         column="ID"                                                 
  +         jdbc-type="BIGINT"                                          
  +         primarykey="true"                                           
  +         autoincrement="true"                                        
  +         access="anonymous"                                          
  +      />                                                             
  +                                                                     
  +      <field-descriptor                                              
  +         name="webAppId"                                             
  +         column="WEB_APPLICATION_ID"                                 
  +         jdbc-type="BIGINT"                                          
  +         access="anonymous"                                          
  +      />                                                             
  +                                                                     
  +      <field-descriptor                                              
  +         name="roleName"                                             
  +         column="ROLE_NAME"                                          
  +         jdbc-type="VARCHAR"                                         
  +      />                                                             
  +                                                                     
  +       <field-descriptor                                             
  +         name="description"                                          
  +         column="DESCRIPTION"                                        
  +         jdbc-type="VARCHAR"                                         
  +      />                                                             
  +                                                                     
  +   </class-descriptor>                                               
      
     
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to