Tuesday, March 29, 2016

Get Instance Rights of Resources in Clarity

SELECT DISTINCT srm.last_name "Last Name",
srm.first_name "First Name",
srm.unique_name "Resource ID",
srm.email "Email Address",
srm.user_id "Username",
a.right_id, g.right_type, g.description description, o.name right_type_name,
g.group_name right_name, g.group_code, g.is_automatic,
Date "Extract Date"
FROM 
cmn_sec_assgnd_obj_perm a, 
cmn_sec_groups_v g, 
odf_objects_v o,
SRM_RESOURCES srm,
cmn_sec_users cmn,
prj_obs_associations aso,
obs_units_flat_by_mode mde
WHERE 
a.principal_id = cmn.id
AND a.principal_type = 'USER'
AND a.right_id = g.id
AND g.right_type = o.right_code
AND g.language_code = 'en'
AND o.language_code = 'en'
AND g.is_active=1
AND cmn.id=srm.user_id
AND aso.record_id = srm.id
AND mde.linked_unit_id = aso.unit_id
AND mde.unit_mode ='OBS_UNIT_AND_CHILDREN'
AND mde.unit_id =5054143
AND aso.table_name ='SRM_RESOURCES'
AND srm.is_active='1'
ORDER BY right_name