How To Use Custom Authorization For Pages In Oracle Apex?

How To Use Custom Authorization For Pages In Oracle Apex?

How To Use Custom Authorization For Pages In Oracle Apex?

 

In Today's Post / Video, I Will Try To Discuss In Detail How To Use Custom Authorization For Pages In Oracle Apex.

In Oracle Apex Applications, It Is Very Important To Use Menu Access And Page Access According To User Or Group. I've Previously Posted Videos And Detailed Descriptions And SQL Codes On How To Use Custom User Authentication And Menu Access By User Group. If You Haven't Seen My Previous Videos And Posts, You Can Check Out The Videos And Posts By Clicking The Link Below. If You Encounter Any Issues Related To Custom User Authentication, Menu Access And Custom Page Access, You Must Let Us Know In The Comments, Mail, Or Message. I Will Always Try To Be By Your Side, Inshallah.

🔗 Custom User Authorization Scheme In Oracle Apex. Part-1 Video-
            URL-https://youtu.be/z2uEawNglJU
🔗 Custom User Authorization Scheme In Oracle Apex. Part-1 BlogPost-
            URL-https://cutt.ly/iPHIfxy

🔗 Custom User Authorization Scheme In Oracle Apex. Part-2 Video-
            URL-https://youtu.be/Y48bJ-Gh0WI
🔗 Custom User Authorization Scheme In Oracle Apex. Part-2 BlogPost-
            URL-https://cutt.ly/ePHG4ID
 

Steps To How To Use Custom Authorization For Pages In Oracle Apex?

The Full Steps For Using Custom Page Access In The Oracle Apex Application Are Discussed Below.

1. First, We Will Create A Table To Use Custom Page Access. 
Name- APPLICATION_PAGE_ACCESS
SQL Code-
CREATE TABLE  "APPLICATION_PAGE_ACCESS" 
   (	"OID" NUMBER NOT NULL ENABLE, 
	"USER_GROUP_OID" NUMBER NOT NULL ENABLE, 
	"PAGE_ID" NUMBER NOT NULL ENABLE, 
	"PERMISSION" NUMBER(1,0) DEFAULT 1, 
	"APP_ID" NUMBER, 
	"INSERT_BY" NVARCHAR2(50), 
	"INSERT_DATE" DATE, 
	"UPDATE_BY" NVARCHAR2(50), 
	"UPDATE_DATE" DATE, 
	 CONSTRAINT "APPLICATION_PAGE_ACCESS_PK" PRIMARY KEY ("OID")
  USING INDEX  ENABLE, 
	 CONSTRAINT "APPLICATION_PAGE_ACCESS_U01" UNIQUE ("USER_GROUP_OID", "PAGE_ID")
  USING INDEX  ENABLE
   )  ENABLE ROW MOVEMENT
/
2. Once The Table Creation Is Complete, We Will Create A Blank Page At This Stage. 
Name- User Page Permission
3. Create A Region For The Filtered Report I Can See 
Name- Filter Option
4. Create A Item. 
Name- USER_GROUP
Type- Select List
SQL Code-
SELECT GROUP_TITLE, OID
    FROM USER_GROUP
ORDER BY 1
4. Create A New Region To View The User Page Permission Report. 
Name- Page Permission Report
SQL Code-
SELECT p.PAGE_NAME,
       p.PAGE_ID,
       (SELECT GROUP_TITLE
          FROM USER_GROUP
         WHERE OID = a.USER_GROUP_OID)    USER_GROUP_OID,
       (SELECT STATUS
          FROM IS_ACTIVATE
         WHERE OID = a.PERMISSION)        STATUS,
       a.APP_ID
  FROM apex_application_pages p, APPLICATION_PAGE_ACCESS a
 WHERE     p.PAGE_ID = a.PAGE_ID
       AND p.application_id = :APP_ID
       AND ( :P9_USER_GROUP IS NULL OR a.USER_GROUP_OID = :P9_USER_GROUP)
5. I Will Create A New Region To Give Permission To The Page. 
Name- Add Panel
6. I Will Create Two Items In The Ad Panel Region. 
#The First Item
Name- Group
Type-Select List
SQL Code-
SELECT GROUP_TITLE, OID
    FROM USER_GROUP
ORDER BY 1
# The Second Item- 
Name- Page
ype-Select List
SQL Code-
SELECT PAGE_NAME || ' (P-' || PAGE_ID || ')' AS d, PAGE_ID AS r
  FROM apex_application_pages
 WHERE application_id = :APP_ID;
7. I Will Create A Button 
Name- SAVE_PAGE
Set Static ID= SAVE_PAGE
8. Create Dynamic Action 
Name - Save Access
Action- Execute Sercer-side Code
PL/SQL code-
DECLARE
    l_selected   APEX_APPLICATION_GLOBAL.VC_ARR2;
BEGIN
    l_selected := APEX_UTIL.STRING_TO_TABLE ( :P9_PAGE);

    FOR i IN 1 .. l_selected.COUNT
    LOOP
        INSERT INTO APPLICATION_PAGE_ACCESS (OID,
                                             USER_GROUP_OID,
                                             PAGE_ID,
                                             PERMISSION,
                                             APP_ID)
                 VALUES (
                            (SELECT NVL (MAX (oid), 0) + 1
                               FROM APPLICATION_PAGE_ACCESS),
                            :P9_GROUP,
                            l_selected (i),
                            1,
                            :APP_ID);
    END LOOP;
END;

Now We Will Save Some Pages According To The User Group With Permission.

Our Work Is Almost Finished, At This Stage We Will Create A New Authorization Schemes From The Shared Components Of The Application To Security.

9. To create Authorization Schemes, first go to Shared Components. 
Click On Authorization Schemes From Security.
Click On The Create Button.
Click On The Next Button. 
Name-User Page Access
Scheme Type:- PL/SQL Function Returning Boolean
PL/SQL Function Body-
DECLARE
    v_count   NUMBER := 0;
BEGIN
    SELECT COUNT (*)
      INTO v_count
      FROM APPLICATION_PAGE_ACCESS
     WHERE     USER_GROUP_OID = :P0_USER_GROUP
           AND PAGE_ID = :APP_PAGE_ID
           AND PERMISSION = 1;

    IF v_count = 0
    THEN
        RETURN FALSE;
    END IF;

    RETURN TRUE;
END;
Identify Error Message Displayed When Scheme Violated- 
You Are Not Authorized To This Page
 
Validate authorization scheme:- Always (No Caching)
Click Create Authorization Scheme 

Pl/SQL Function Body A Global Item P0_user_group Is Used In SQL Code. Previous Videos / Posts Have Shown How To Create A Global Item And How To View User Group Values In A Global Item. If You Haven't Seen The Set Dynamic Menu According To User Group Video / Post, You Can Watch The Video / Post By Clicking On The Link Below.

🔗 Set Dynamic Menu According To User Group, Video-
            URL-https://youtu.be/XR5UXjcV1Cg
🔗 Set Dynamic Menu According To User Group, BlogPost-
            URL-https://cutt.ly/UAx2ELQ

This Is Our Last Step.

10. Go To The Proprietors Of The Application. 
11. Click Edit Application Definition- Click Security 

Go To The Authorization Scheme And Select The New User Page Access That We Have Created In The Select List.

In This Article, We Are Going To Discuss Oracle Apex Approval And Custom Approval. There Are Two Ways To Provide System Protection For Oracle Application Express (Apex) Applications. The Two Methods Are Authentication And Approval. The Authentication Method Has Already Been Discussed In The Previous Article, Which Was Applied On The Login Page. Authorization Is Used To Create Deep Security Controls. It Can Be Implemented In Tabs, Pages, Or Regions. Using A Combination Of Authentication And Approval Will Create An Application With Confidence Security.

 

🔗 Demo Application-
            URL- Demo Application
            Username - demo, Pass- demo
 

I hope everyone will like it. Please watch the full video,
Comment on any of your problems, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable. Visit my blog site, new technology related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work.
Please stay tuned by subscribing to the YouTube channel, and encourages new videos to be uploaded.
=================
Visit my site to get more collaborative posts about Oracle Apex and subscribe to my YouTube channel. Thanks.
Comment on any of your issues, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable.
Visit my blog site, new technology-related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work.
==============================

🙍🏾‍ Md jABER HOSSEN
📲 Mobile- +8801760688286
📨 Email- jaberit786@gmail.com
🌐 FB- facebook.com/mdjaber.hossen1
Please Subscribe to My Channel

Many thanks for visiting the site.

Then Enjoy.........................

User Group Create Table SQL Code And SQL Code To Insert Some Data !!

Crete User Group Table

CREATE TABLE  "USER_GROUP" 
   (	"OID" NUMBER, 
	"PID_PARENT" NUMBER, 
	"GROUP_TITLE" NVARCHAR2(30), 
	"GROUP_DESCRIPTION" NVARCHAR2(250), 
	"IS_ACTIVE" NVARCHAR2(1), 
	"Create_By" VARCHAR2(200), 
	"Create_Date" DATE, 
	"Update By" VARCHAR2(200), 
	"UPDATE_DATE" DATE, 
	 CONSTRAINT "ACL_GROUP_PK" PRIMARY KEY ("OID")
  USING INDEX  ENABLE
   )  ENABLE ROW MOVEMENT
/

SQL Code To Insert Some Data

Insert into USER_GROUP
   (OID, GROUP_TITLE, GROUP_DESCRIPTION, IS_ACTIVE)
 Values
   (1, 'Admin', 'Application Administrator', 1);
Insert into USER_GROUP
   (OID, GROUP_TITLE, GROUP_DESCRIPTION, IS_ACTIVE)
 Values
   (2, 'Shop_owner', 'The shop owner, দোকানের মালিক।', 1);
Insert into USER_GROUP
   (OID, GROUP_TITLE, GROUP_DESCRIPTION, IS_ACTIVE)
 Values
   (3, 'Store_manager', 'Store manager, দোকানের ম্যানেজার', 1);   

Insert into USER_GROUP
   (OID, GROUP_TITLE, GROUP_DESCRIPTION, IS_ACTIVE)
 Values
   (5, 'Shop_management', 'Shop manager, দোকান পরিচালনাকারী।', 1); 
   
Insert into USER_GROUP
   (OID, GROUP_TITLE, GROUP_DESCRIPTION, IS_ACTIVE)
 Values
   (6, 'Salesman', 'Store Product Salesman, দোকানের প্রোডাক্ট সেলসম্যান।', 1);
Insert into USER_GROUP
   (OID, GROUP_TITLE, GROUP_DESCRIPTION, IS_ACTIVE)
 Values
   (7, 'Data_entry', 'Product entry employee, সকল প্রকার ডাটা এন্ট্রির কাজ করবেন।', 1);
Insert into USER_GROUP
   (OID, GROUP_TITLE, GROUP_DESCRIPTION, IS_ACTIVE)
 Values
   (8, 'Normal_User', 'Normal user of the application, অ্যাপ্লিকেশন নরমাল ব্যবহারকারী.', 1);
User Group Create Table SQL Code And SQL Code To Insert Some Data !!

Crete Is Activate Table

CREATE TABLE  "IS_ACTIVATE" 
   (	"OID" NUMBER, 
	"STATUS" VARCHAR2(30), 
	 CONSTRAINT "IS_ACTIVATE_PK" PRIMARY KEY ("OID")
  USING INDEX  ENABLE
   )  ENABLE ROW MOVEMENT
/

SQL Code To Insert Some Data

Insert into IS_ACTIVATE
   (OID, STATUS)
 Values
   (1, 'Activate');
Insert into IS_ACTIVATE
   (OID, STATUS)
 Values
   (2, 'Inactive');

Post a Comment

Hlo Sir

Previous Post Next Post