首页 > 解决方案 > 通过 DB 进行导航菜单访问控制 - Apex oracle

问题描述

我有一个表,其中存储有 Page 及其页码。我只想在导航菜单上显示那些页码分配给最终用户的栏。我该怎么做?我正在使用 Apex 19.1

标签: oracleoracle-apexoracle-apex-19.1

解决方案


创建一个返回布尔值的函数,说明某个用户是否可以(或不能)访问某个页面,例如

create table t_access as
  select 1 page_no, 'LITTLE' app_user, 'Y' yn from dual union all  --> can access page 1
  select 2 page_no, 'LITTLE' app_user, 'N' yn from dual;           --> can NOT access page 2

create or replace function f_access(par_page_no in number, par_app_user in varchar2)
  return boolean 
as
  l_yn t_access.yn%type;
begin
  select a.yn
    into l_yn
    from t_access a
    where a.page_no = par_page_no
      and a.app_user = par_app_user;
  return l_yn = 'Y';
exception
  when no_data_found then
    return false;
end;

在导航列表条目的条件属性中使用该函数;使其成为“返回布尔值的 PL/SQL 函数体”为

    return f_access(1, :APP_USER);

推荐阅读