 |
 |
Archives of the TeradataForum
Message Posted: Mon, 13 Jan 2003 @ 21:52:29 GMT
| Subj: | | Re: Data selection |
| |
| From: | | Jim Downey |
I have a metadata table that I want to limit who has access based on their userid. The following code is embedded in a macro (it
could be a view) and only returns rows where the metadata status of the row exceeds the minimum value that the user is allowed to
see. (Business users can only see high value metadata while systems users might want to see all of it). The users with 'special'
privileges are kept in a table named Metadata_Users. Rather than maintain ALL user ids, our web application defaults to logging on
with a generic userid (Metadata_guest). If the user id is not found, the sub-query returns the value associated with the generic
id.... Actually it returns the min value which works for me but you would want to validate it works for what you want to
accomplish.
AND Metadata_Status_In >=
(
SEL MIN(READ_Metadata_Status_In) AS Metadata_Status_In
FROM METADATA.METADATA_USERS
WHERE METADATA_USERID IN (USER,'METADATA_GUEST')
)
I hope this helps.
Jim
| |