如何实现 Oracle Apex 区域授权 [英] How does on implement Oracle Apex region authorization

查看:72
本文介绍了如何实现 Oracle Apex 区域授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

绑定变量 :app_region_id 工作区域但它不适用于授权方案

The bind variable :app_region_id works region however it does not work for the authorization scheme

区域的 SQL 语句

SELECT  WORKSPACE,APPLICATION_ID , PAGE_ID, REGION_ID, REGION_NAME,AUTHORIZATION_SCHEME, :app_region_id
from apex_application_page_regions 
where region_id = :app_region_id

授权方案
方案类型:存在SQL查询
SQL 查询:

Select  1
from apex_application_page_regions 
where region_id = :app_region_id; 

我应该使用哪个绑定变量来实现区域授权.我想实现的代码,它没有返回想要的结果

which bind variable should I use to achieve region authorization. The code that I wanted to implement, it does not return the desired results

Select 1
    from AD_GRP_APEX_REGION_ASSOC r,
       AD_GRP_EMP e
    where  e.ad_grp = r.ad_grp
    and e.user_id =  :app_user
    and r.region_id = :app_region_id

推荐答案

变量 :app_region_id 不像 :APP_USER 那样是一个全局变量.授权模式仅适用于与 SESSION 相关联的全局变量,而不适用于页面中的元素(例如区域).除此之外,拥有它没有任何意义,因为您使用 AUTHORIZATION SCHEMAS 来限制对应用程序中不同组件的访问.让我展示如何将授权模式应用于 Oracle Apex 中的区域.

The variable :app_region_id is not a global variable in the same way as :APP_USER. Authorization schemas only work with global variables which are associated to the SESSION, not to a element in a page ( such is a region ). Besides that, it does not make any sense to have it because you use AUTHORIZATION SCHEMAS to limit access to different components in your application. Let me show how to apply authorization schemas to regions in Oracle Apex.

假设我有一个包含三个区域的测试应用程序:

Let's imagine I have a test application with three regions:

  • 区域 1 显示查询的一个字段(一行)
  • 区域 2 显示查询的另一个字段(一行)
  • 区域 3 仅显示一条消息(静态内容)

没有任何身份验证架构,它会显示这一点

Without any authentication schema, it shows this

现在,让我们创建一个授权模式示例,该示例推导出用户是谁,并基于此仅显示区域 3.在我的情况下,我的应用程序默认使用身份验证模式(apex users),因此登录的用户始终分配给全局变量 :APP_USER.

Now, let's create an authorization schema example that derives who is the user and based on this will show only region 3. In my case my application uses the authentication schema by default ( apex users ) so the user logged is always assigned to the global variable :APP_USER.

应用程序生成器 -->共享组件 -->授权模式

Application Builder --> Shared Components --> Authorization schemas

Authorization Schema --> MY_TEST
Type --> Exist SQL QUERY 

select 1 from dual where exists  ( select user_name from apex_workspace_apex_users where workspace_name = 'MY_WORKSPACE' and user_name = upper(':APP_USER') )

当用户存在时,此授权模式将禁止查看区域,所以基本上对每个人来说,显然我这样做只是为了测试目的.

This authorisation schema will forbid to see a region when the user exists, so basically for everybody, obviously I am doing it just for testing purposes.

然后我修改了 REGION 1 和 REGION 2 的属性,将授权模式更改为 MY_TEST

Then I modified attributes of REGION 1 and REGION 2 , changing the authorization schema to MY_TEST

现在,当我执行应用程序时,我只能在页面中看到 region3.

Now, when I execute the application , I can only see the region3 in the page.

这篇关于如何实现 Oracle Apex 区域授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆