SELECT DISTINCT SU.OPRID ,SU.SETID , SU.DEPTID FROM PS_SEC_DEPT_USER SU , PS_DEPT_TBL CF1 , PS_INSTALLATION_FS I1 , PS_SEC_CF_PROD SP1 , PS_SEC_FIELDS_TBL SF1 WHERE SU.SETID = CF1.SETID AND SU.DEPTID = CF1.DEPTID AND SU.PRODSRCID = SP1.PRODSRCID AND I1.CF_SECURITY = '1' AND SP1.PRODSRCID='FGL' AND SP1.ACTIVE_PROD='A' AND SF1.FIELDNAME='DEPTID' AND SF1.ACTIVE_FLAG='A' UNION SELECT DISTINCT RU.ROLEUSER ,SR.SETID , SR.DEPTID FROM PS_SEC_DEPT_ROLE SR , PS_DEPT_TBL CF2 , PS_INSTALLATION_FS I2 , PS_SEC_CF_PROD SP2 , PS_SEC_FIELDS_TBL SF2 , PSROLEUSER RU WHERE SR.SETID = CF2.SETID AND SR.DEPTID = CF2.DEPTID AND SR.PRODSRCID = SP2.PRODSRCID AND I2.CF_SECURITY = '2' AND SP2.PRODSRCID='FGL' AND SP2.ACTIVE_PROD='A' AND SF2.FIELDNAME='DEPTID' AND SF2.ACTIVE_FLAG='A' AND RU.ROLENAME = SR.ROLENAME UNION SELECT DISTINCT OP.OPRID ,SC.SETID , SC.DEPTID FROM PS_SEC_DEPT_PERM SC , PS_DEPT_TBL CF3 , PS_INSTALLATION_FS I3 , PS_SEC_CF_PROD SP3 , PS_SEC_FIELDS_TBL SF3 , PSOPRDEFN OP WHERE SC.SETID = CF3.SETID AND SC.DEPTID = CF3.DEPTID AND SC.PRODSRCID = SP3.PRODSRCID AND I3.CF_SECURITY = '3' AND SP3.PRODSRCID='FGL' AND SP3.ACTIVE_PROD='A' AND SF3.FIELDNAME='DEPTID' AND SF3.ACTIVE_FLAG='A' AND OP.ROWSECCLASS = SC.ROWSECCLASS UNION SELECT DISTINCT 'ALLUSERS' AS OPRID , CF4.SETID , CF4.DEPTID FROM PS_DEPT_TBL CF4 , PS_INSTALLATION_FS I4 , PS_SEC_CF_PROD SP4 , PS_SEC_FIELDS_TBL SF4 WHERE I4.CF_SECURITY = '0' OR (SP4.PRODSRCID = 'FGL' AND SP4.ACTIVE_PROD = 'I') OR (SP4.PRODSRCID = 'FGL' AND SP4.ACTIVE_PROD = 'A' AND SF4.FIELDNAME='DEPTID' AND SF4.ACTIVE_FLAG='I') UNION SELECT DISTINCT 'ALLUSERS' AS OPRID , CF5.SETID , ' ' AS DEPTID FROM PS_DEPT_TBL CF5 UNION SELECT 'ALLUSERS' AS OPRID , ' ' AS SETID , ' ' AS DEPTID FROM PS_INSTALLATION_FS
|