0 Replies Latest reply on Mar 7, 2009 3:51 PM by Zabin Begum

    Authorization Issue

    Zabin Begum Newbie

      Hello Friends.


      First of all thanks Adrien Orsier, for your reply in the topic of security. It worked, but got some other issues.


      I am trying to implement authorization in my project.  I am using jpaPermissionStore.  I have entities for roles and users.  Now I want to create two permission entities in which i can map user and role entities.
      I have written a userPermission an rolePermission entities.  They are like:


      @Entity
      public class RolePermission implements Serializable {  
                   private Integer permissionId;
                   private String recipient;
                   private String target;
                   private String action;             
                   
                   private List<Role> roles;
      
                   @Id @GeneratedValue
                   @Column(name="role_permission_id")
                   public Integer getPermissionId() {
                      return permissionId;
                   }
      
                   public void setPermissionId(Integer permissionId) {
                      this.permissionId = permissionId;
                   }
      
                   @PermissionRole 
                   public String getRecipient() {
                      return recipient;
                   }
      
                   public void setRecipient(String recipient) {
                        this.recipient = recipient;
                   }
      
                   @PermissionTarget
                   public String getTarget() {
                      return target;
                   }
      
                   public void setTarget(String target) {
                      this.target = target;
                   }
      
                   @PermissionAction
                   public String getAction() {
                      return action;
                   }
      
                   public void setAction(String action) {
                      this.action = action;
                   }
                   
                   @ManyToMany(targetEntity=Role.class)
                   @JoinTable(
                               name="role_name_permission",
                               joinColumns = @JoinColumn(name = "role_permission_id"),
                               inverseJoinColumns = @JoinColumn(name = "role_id"),
                               uniqueConstraints = @UniqueConstraint(columnNames = {"role_permission_id", "role_id"}))
                     public List<Role> getRoles() {
                          return roles;
                     }
                     
                     public void setRoles(List<Role> roles) {
                          this.roles = roles;
                     }
       
      }          



      similarly for user.


      I am not able to deploy.  What is the problem. Cant I use many to many in the permission class.  If so, how? 
      How can I use jpaPermissionStore for mapping my user and roles?
      Please help