Hi,
I have the following situation. In our database we have a reports table that stores reports and role ids.
Basically this table shows what roles can view what reports.
ReportID roles_allowed
12 MIS,MANAGER,ACCOUNTS,DP
14 ACCOUNTS,MIS,DP
15 CSRUP,MANAGER
Now when a user logs in his roles are set in a comma delimited list. such as MIS,ACCOUNTS etc. this is set as a session variable.
Now what i want is to do a compare of his user roles set in the seesion to the rows (the roles_allowed column) in the table
and bring back any records that contains any of the roles matched in the roles session variables
So if person A logs and his session role variable is MIS,DP it will bring back report IDS 12 and 14 since MIS and DP are contained in both these reports.
I'm doing something like the following but it doesn't seem to work
SELECT
report_id,category,name,description,max_instance,
last_run_date,roles_allowed,access_level,service_center,
fuseaction ,created_by,created_date,amended_by,
amendment_date,user_comment
FROM Report
WHERE 1=1
AND UPPER(trim(roles_allowed)) like '%MIS,DP%'
can anyone help me please?
thanks
I have the following situation. In our database we have a reports table that stores reports and role ids.
Basically this table shows what roles can view what reports.
ReportID roles_allowed
12 MIS,MANAGER,ACCOUNTS,DP
14 ACCOUNTS,MIS,DP
15 CSRUP,MANAGER
Now when a user logs in his roles are set in a comma delimited list. such as MIS,ACCOUNTS etc. this is set as a session variable.
Now what i want is to do a compare of his user roles set in the seesion to the rows (the roles_allowed column) in the table
and bring back any records that contains any of the roles matched in the roles session variables
So if person A logs and his session role variable is MIS,DP it will bring back report IDS 12 and 14 since MIS and DP are contained in both these reports.
I'm doing something like the following but it doesn't seem to work
SELECT
report_id,category,name,description,max_instance,
last_run_date,roles_allowed,access_level,service_center,
fuseaction ,created_by,created_date,amended_by,
amendment_date,user_comment
FROM Report
WHERE 1=1
AND UPPER(trim(roles_allowed)) like '%MIS,DP%'
can anyone help me please?
thanks