5 Replies Latest reply on Nov 17, 2009 6:27 PM by Joshua D

    Extending PermissionResolver

    Andre Fernando Salvati Novice

      Hi,


      I'm developing a multitenant application and get some questions:


      1) I need different permission sets for the same user. For example, when user U is logged in company C, I need company C permission set for user U; when user U is logged in company C1, I need company C1 permission set for user U, and so on.


      I tried to achieve this by inserting company on MyPermission entity. I think the next step is to extend  PermissionResolver and make something similar to PersistentPermissionResolver adding company validation. How can I get company from MyPermission entity? Do I need to bring MyPermission again using another Query? Is it the right way to extend Seam Security Framework?



            Integer company = identity.getCompany();
      
            for (Permission permission : permissions)
            {
               if (permission.getRecipient() instanceof SimplePrincipal &&
                     username.equals(permission.getRecipient().getName() && company.equals(???????))
               {
                  return true;
               }
      




      2) Is it possible to deactivate PersistentPermissionResolver (or any other Resolver) from the Resolver chain?


      Thanks.