12 Replies Latest reply: May 30, 2013 3:51 AM by VC RSS

    Accessing Region Id from Authorization Scheme

    pjturley
      Hi,

      To handle security in our application we have a table that holds the particular regions on a page that the user has access to. We currently use a condition in each region that calls a PL/SQL function, passes in the region id and checks to see if that user has access to the region.

      What I want to do is move this process into an Authorization Scheme, but is it possible to get hold of the region_id of the region the Authorization Scheme is running against?

      Cheers

      Paul
      http://pjturley.blogspot.co.uk/
        • 1. Re: Accessing Region Id from Authorization Scheme
          InoL
          It is not possible to use for instance #REGION_STATIC_ID# in an authorization scheme. There are already threads about the same, e.g.:
          Authorization Scheme using #REGION_STATIC_ID#
          Get region ID within region condition PLSQL
          • 2. Re: Accessing Region Id from Authorization Scheme
            pjturley
            Thanks, I saw those threads but rather hoped that apex 4.2 had introduced some enhanced functionality.

            Cheers

            Paul
            http://pjturley.blogspot.co.uk/
            • 3. Re: Accessing Region Id from Authorization Scheme
              VC
              pjturley wrote:
              Thanks, I saw those threads but rather hoped that apex 4.2 had introduced some enhanced functionality.

              Cheers

              Paul
              Hi Paul,

              There is no improvement in 4.2 regarding this.

              I would suggest to go for a authorization scheme plugin where you can incorporate your custom security logic using custom tables, may be you can reference the region id there.

              I know there is lack of documentation on that but I'm sure it will be easy for you. :) :)

              http://chrisonoracle.wordpress.com/2011/05/09/how-to-create-an-apex-4-1-authorization-plugin/
              http://www.apex-at-work.com/2011/12/advanced-ways-using-authorization.html

              Cheers,
              Vikram
              • 4. Re: Accessing Region Id from Authorization Scheme
                pjturley
                Ah Vikram,

                I looked at the plugin route but can't see how I can get the region_id from within the plugin.

                I'm sure you remember this code and our security model, Come back :o)

                Cheers

                Paul
                http://pjturley.blogspot.co.uk/
                • 5. Re: Accessing Region Id from Authorization Scheme
                  Patrick Wolf-Oracle
                  Hi Paul,

                  have a look at
                  apex_application.get_component().id
                  It's not officially documented, but it should provide you what you are looking for.

                  Regards
                  Patrick
                  -----------
                  Member of the APEX development team
                  My Blog: http://www.inside-oracle-apex.com
                  APEX Plug-Ins: http://apex.oracle.com/plugins
                  Twitter: http://www.twitter.com/patrickwolf
                  • 6. Re: Accessing Region Id from Authorization Scheme
                    pjturley
                    Hi Patrick,

                    Thanks for the info, that seems to give me the id of the actual authorization scheme when I grab it in my plugin (which is linked to the authorization scheme). What I am after is the region_id the authorization scheme is linked to. The authorization scheme will be linked to all the regions on the page and the plugin will work out based on the region_id if the user can see that region. We store the region_id's in security table which is configured and linked to users. Well that's the idea anyway!!

                    Cheers

                    Paul
                    http://pjturley.blogspot.co.uk/
                    • 7. Re: Accessing Region Id from Authorization Scheme
                      Patrick Wolf-Oracle
                      Hi Paul,

                      I'm not sure if authorizations will work at all for you. Please keep in mind that authorizations are using caching. If you use the same authorization for all your regions, it will just fire once and store the result for subsequent calls within the same page request.

                      Regards
                      Patrick
                      -----------
                      Member of the APEX development team
                      My Blog: http://www.inside-oracle-apex.com
                      APEX Plug-Ins: http://apex.oracle.com/plugins
                      Twitter: http://www.twitter.com/patrickwolf
                      • 8. Re: Accessing Region Id from Authorization Scheme
                        pjturley
                        Hi Patrick,

                        Ok no problem, our security model currently uses a condition on the region to call a pl/sql function which returns true or false, so I will leave that in place as it is then. As it is executed every time the page is requested I thought we might be able to utilize the authorization schemes instead and manipulate the scheme to almost accept a parameter based on the region it was connected to.

                        No worries, our current solution works well enough.

                        Thanks

                        Paul
                        http://pjturley.blogspot.co.uk/
                        • 9. Re: Accessing Region Id from Authorization Scheme
                          VC
                          pjturley wrote:
                          Ah Vikram,

                          I'm sure you remember this code and our security model, Come back :o)
                          hahaha :) Yes I remember that good old days ..but its a long way from Edinburgh.. :D

                          Vikram
                          • 10. Re: Accessing Region Id from Authorization Scheme
                            VC
                            Patrick Wolf wrote:
                            Hi Paul,

                            have a look at
                            apex_application.get_component().id
                            It's not officially documented, but it should provide you what you are looking for.
                            Patrick,

                            Thanks for this.

                            just did a quick test and it can also be used in the actual components and not just in plugins!!

                            @Paul

                            this might be any use for you? I mean replace the function call to pass this value rather than seq??

                            I have actually tested with the below region condition and it works fine. http://apex.oracle.com/pls/apex/f?p=46417:50
                            //condition type: PLSQL Expression
                            apex_application.get_component().id=20194570014082774815
                            • 11. Re: Accessing Region Id from Authorization Scheme
                              fac586
                              VC wrote:
                              hahaha :) Yes I remember that good old days ..but its a long way from Edinburgh.. :D
                              Vikram

                              Edinburgh? Doing APEX? Any vacancies? ;-)
                              • 12. Re: Accessing Region Id from Authorization Scheme
                                VC
                                fac586 wrote:
                                VC wrote:
                                hahaha :) Yes I remember that good old days ..but its a long way from Edinburgh.. :D
                                Vikram

                                Edinburgh? Doing APEX? Any vacancies? ;-)
                                Yes Paul, moved here a couple of months ago... lot more into E-Business suite technical work (which is my core strength) as well as some apex stuff.
                                hmm sorry there are none for apex at the moment but will let you know if one comes!