4 Replies Latest reply: Apr 4, 2013 10:09 PM by marlis RSS

    how to retrieve current user role

    marlis
      I am using ADF security. User can have >2 roles to have access to the jsf page.
      And I want to catch on the database side, users current role, wich grants user for access current page.
      Any ideas? Thanks.
        • 1. Re: how to retrieve current user role
          RaviNuka
          Hi,

          You can create any plsql package and pass the security roles/username from application as parameters to your plsql package and use them in database accordingly. As you have multiple roles per user, you can pass them as ArrayList or Map and in plsql package create a plsql table to read them.

          Regards,
          Ravi Nuka.
          • 2. Re: how to retrieve current user role
            marlis
            I need to pass not list of roles. I need to pass current role.
            For example user have role admin and role accounter. After loggin in he has granted 2 roles. But how can I catch current role, that granted to open current jsf page.
            • 3. Re: how to retrieve current user role
              RaviNuka
              Hi Marlis,

              For your question, though user has multiple roles, the page which he is viewing might have authorized to only one user role (check authorization in Jazn file of your application) and as you already know to which role the page is authorized, you can directly pass that specific role to your database package. My point is instead of trying to see user current role, try to get the role to which the page is authorized and use that in your plsql package.

              problem comes in case only when user has two roles accountant and manager and both has access to view the page (which is not good practice, user can be either accountant or manager but not both).

              Regards,
              Ravi Nuka.

              Edited by: Ravi Nuka on Apr 4, 2013 10:54 AM
              • 4. Re: how to retrieve current user role
                marlis
                Thank you.
                I 'll take you aproach.