5 Replies Latest reply on Sep 9, 2008 11:23 AM by gaboo.gael.livre-rare-book.com

    IdentifierStrategy issue with non-entity classes

    zergspirit

      Hi.


      I'm trying to handle permissions using the new Seam Security framework, and more specifically, I'm trying to persist permission related to a non-entity object.
      I read the doc, but I'm not quite sure what I'm supposed to do.
      I'd have thought that there was a default behaviour to handle non-entity object passed to PermissionManager.grantPermission, taking the @Name annotation or at least the name of the object's class, but it's not the case.


      For instance, I have a really simple class :




      public class TestClass {
      
      }
      



      And I try to grant a permission on this class to my Role testRole:



      PermissionManager.instance().grantPermission(new org.jboss.seam.security.permission.Permission(new TestClass(),"test",new Role("testRole")));




      So, if I understood the doc clearly, I'd suppose I would end up having a permission persisted through my JpaPermissionStore having TestClass as target and test as action, but it's persisted with an empty target instead.
      I tryed to annotate this class using


      @Name("TestClass")



      or


      @Identifier(name="TestClass")




      but it didn't change anything.


      Am I suppose to create my custom Identifier Strategy, or is there something I missed about a default behaviour regarding non-entity classes?