Thursday 25 June 2020

Oracle Cloud + Query to get The Data Access for an User

SELECT USERNAME,PERSON_NUMBER,person_name,ROLE_NAME,ROLE_CODE,SECURITY_CONTEXT ,SECURITY_CONTEXT_VALUE
FROM(
SELECT
 PU.USERNAME ,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 ROLE.ROLE_NAME ROLE_CODE,
 'DATA ACCESS SET' security_context,
 GL.NAME security_context_value
 FROM
 fusion.fun_user_role_data_asgnmnts role,
 fusion.gl_access_sets gl,
 fusion.per_users pu,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
 ase_role_b r,
 ase_role_tl rtl
WHERE
 GL.ACCESS_SET_ID = ROLE.ACCESS_SET_ID
 AND PU.USER_GUID = ROLE.USER_GUID
 AND ROLE.ROLE_NAME=R.CODE
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
 AND papf.person_id=ppnf.person_id
 AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate
 AND nvl(r.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
 PU.USERNAME,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 ROLE.ROLE_NAME ROLE_CODE,
 'BUSINESS UNIT' security_context,
 BU.BU_NAME security_context_value
FROM
 fusion.fun_all_business_units_v bu,
 fusion.fun_user_role_data_asgnmnts role,
 fusion.per_users pu,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
 ase_role_b r,
 ase_role_tl rtl
WHERE
 ROLE.ORG_ID = BU.BU_ID
 AND PU.USER_GUID = ROLE.USER_GUID
 AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
 pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'LEDGERS' security_context,
 led.name security_context_value
FROM
 fusion.gl_ledgers led,
 fusion.fun_user_role_data_asgnmnts role,
 fusion.per_users pu,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
 ase_role_b r,
 ase_role_tl rtl
WHERE
 role.ledger_id = led.ledger_id
 and pu.user_guid = role.user_guid
 and role.role_name=r.code
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
 pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'ASSET BOOK' security_context,
 book.book_type_name security_context_value
FROM
 FUSION.FUN_USER_ROLE_DATA_ASGNMNTS ROLE,
 FUSION.FA_BOOK_CONTROLS BOOK,
 FUSION.PER_USERS PU,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
 ase_role_b r,
 ase_role_tl rtl
WHERE
 BOOK.BOOK_CONTROL_ID = ROLE.BOOK_ID
 AND PU.USER_GUID = ROLE.USER_GUID
 AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'INTERCOMPANY ORGANIZATION' security_context,
 INTERCO.INTERCO_ORG_NAME security_context_value
FROM
 fusion.fun_user_role_data_asgnmnts role,
 fusion.fun_interco_organizations interco,
 fusion.per_users pu,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
 ase_role_b r,
 ase_role_tl rtl
WHERE
 INTERCO.INTERCO_ORG_ID = ROLE.INTERCO_ORG_ID
 AND PU.USER_GUID = ROLE.USER_GUID
  AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'COST ORGANIZATION' security_context,
 COST.COST_ORG_NAME security_context_value
FROM
 FUSION.FUN_USER_ROLE_DATA_ASGNMNTS ROLE,
 FUSION.CST_COST_ORGS_V COST,
 FUSION.PER_USERS PU,
  per_all_people_f papf,
  per_person_names_f_v ppnf,
  ase_role_b r,
 ase_role_tl rtl
WHERE
 COST.COST_ORG_ID = ROLE.CST_ORGANIZATION_ID
 AND PU.USER_GUID = ROLE.USER_GUID
  AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'MANUFACTURING PLANT' security_context,
 MFG.DEF_SUPPLY_SUBINV security_context_value
FROM
 FUSION.FUN_USER_ROLE_DATA_ASGNMNTS ROLE,
 FUSION.RCS_MFG_PARAMETERS MFG,
 FUSION.PER_USERS PU,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
  ase_role_b r,
 ase_role_tl rtl
WHERE
 MFG.ORGANIZATION_ID = ROLE.MFG_ORGANIZATION_ID
 AND PU.USER_GUID = ROLE.USER_GUID
  AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'CONTROL BUDGET' security_context,
 BUDGET.NAME security_context_value
FROM
 FUSION.FUN_USER_ROLE_DATA_ASGNMNTS ROLE,
 FUSION.XCC_CONTROL_BUDGETS BUDGET,
 FUSION.PER_USERS PU,
  per_all_people_f papf,
  per_person_names_f_v ppnf,
  ase_role_b r,
 ase_role_tl rtl
WHERE
 BUDGET.CONTROL_BUDGET_ID = ROLE.CONTROL_BUDGET_ID
 AND PU.USER_GUID = ROLE.USER_GUID
  AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'REFERENCE DATA SET' security_context,
 ST.SET_NAME security_context_value
FROM
 FUSION.FUN_USER_ROLE_DATA_ASGNMNTS ROLE,
 FUSION.FND_SETID_SETS_VL ST,
 FUSION.PER_USERS PU,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
  ase_role_b r,
 ase_role_tl rtl
WHERE
 ST.SET_ID = ROLE.SET_ID
 AND PU.USER_GUID = ROLE.USER_GUID
  AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'INVENTORY ORGANIZATION' security_context,
 INV.ORGANIZATION_CODE security_context_value
FROM
 FUSION.FUN_USER_ROLE_DATA_ASGNMNTS ROLE,
 FUSION.INV_ORG_PARAMETERS INV,
 FUSION.PER_USERS PU,
 per_all_people_f papf,
 per_person_names_f_v ppnf,
  ase_role_b r,
 ase_role_tl rtl
WHERE
 INV.ORGANIZATION_ID = ROLE.INV_ORGANIZATION_ID
 AND PU.USER_GUID = ROLE.USER_GUID
  AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y'
UNION
SELECT
pu.username,
 papf.person_number,
 ppnf.display_name person_name,
 rtl.role_name,
 role.role_name role_code,
 'PROJECT ORGANIZATION CLASSIFICATION' security_context,
 HR.CLASSIFICATION_CODE security_context_value
FROM
 FUSION.FUN_USER_ROLE_DATA_ASGNMNTS ROLE,
 FUSION.HR_ORG_UNIT_CLASSIFICATIONS_F HR,
 FUSION.PER_USERS PU,
  per_all_people_f papf,
  per_person_names_f_v ppnf,
  ase_role_b r,
 ase_role_tl rtl
WHERE
 HR.ORG_UNIT_CLASSIFICATION_ID = ROLE.ORG_ID
 AND PU.USER_GUID = ROLE.USER_GUID
  AND ROLE.ROLE_NAME=R.CODE
 AND r.role_id = rtl.role_id
 AND rtl.language = 'US'
 AND nvl(r.effective_start_date,sysdate) <= sysdate and
     nvl(r.effective_end_date,sysdate) >= sysdate
 AND nvl(pu.suspended,'N') = 'N'
 AND pu.person_id=papf.person_id
 AND nvl(papf.effective_start_date,sysdate) <= sysdate
 AND nvl(papf.effective_end_date,sysdate) >= sysdate
  AND papf.person_id=ppnf.person_id
  AND nvl(ppnf.effective_start_date,sysdate) <= sysdate
 AND nvl(ppnf.effective_end_date,sysdate) >= sysdate
 AND pu.active_flag = 'Y' 
 )
 WHERE username='aalam'
 ORDER BY USERNAME,ROLE_NAME,SECURITY_CONTEXT

Thanks
Amar Alam

7 comments:

Admin said...

Osmania University B.Com 1st, 3rd, 5th Sem Result 2020
Osmania University B.Com 2nd, 4th, 6th Sem Result 2020
You’d outstanding guidelines there. I did a search about the field and identified that very likely the majority will agree with your web page.

KITS Technologies said...

Thanks for the blog article.Thanks Again. Keep writing.
Django training
Go Language online training
Go Language training
Hibernate online training
Hibernate training
Hyperion ESS Base online training
Hyperion ESS Base training

aditya said...


Good post thanks for share information.

AppValley VIP APK
Cami Elliott
lola Iolani Momoa
rolling paper alternatives
Mp3boo
free edu email

kalichmpa said...
This comment has been removed by the author.
Keerthi55 said...

I cannot thank you enough for the blog.Thanks Again. Keep writing.
data science training
python training
angular js training
selenium trainings
java training

health magazine said...

I really appreciate this great post that you have provided us. I guarantee this will benefit most people and myself. thank you very much!

thetechiefind
thetechtrending
trendingwithmedia
xvideostudio video editor apk download
how many centimeters are in a meter
gogoanime app
Smartjailmail
xvideostudio video editor apk free download for pc full version

Henshaw said...

Absolutely this blog is unique and informative. You are a good blog creator and writer. You readily explained every topic! Looking forward to reading more posts from your blog…this site is equally good, just check it out...free music download for offline listening

Post a Comment