Listing Documents In A View based on the Current User Role

pts.
Tags:
Development
Lifecycle development
Hi All ! I need to list the documents in the view for the Current User role.(For Example, I have the user role as 'Developer' enabled, so I need to list all the documents that have been created using this 'Developer' user role). Waiting for a prompt and positive reply. Regards Ravi.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi there,

I’m not sure what context you want to run this in but the following code will fetch a list of views created by the specified user role when run in the query analyser:

IF IS_MEMBER (‘dbo’) = 1
(SELECT dbo.sysobjects.name, dbo.sysusers.name AS UserRole
FROM dbo.sysobjects INNER JOIN
dbo.sysusers ON dbo.sysobjects.uid = dbo.sysusers.uid
WHERE (dbo.sysobjects.xtype = ‘V’) AND (dbo.sysusers.name = ‘dbo’))
ELSE IF IS_MEMBER (‘dbo’) IS NULL
print ‘ERROR: Invalid group / role specified’

If you have a limited number of roles that you need to check you could add similar sections underneath – just substitute dbo with the role name (e.g. developer).

Hope this is a start…

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following