Video Screencast Help

How to get all trustee ids for current user

Created: 23 Apr 2014 | 1 comment
PeeGee's picture

Whenever a user runs a report in the NS, the server adds the users trustee ids as parameters into the report, so that only the resources to which the user has access are being returned.

I would like to achieve similar functionality with a workflow, but I don't understand how to generate the list of all trustee ids the user belongs to (based on security groups and nested groups).

Any hints on how to get those are appreciated as then I could pre filter the data on SQL level, before displaying any resources to the user in the workflow.

Comments 1 CommentJump to latest comment

SK's picture

A report always starts its sql query off with this line, followed by its SELECT statement:- 

 

DECLARE @v1_TrusteeScope nvarchar(max)

SET @v1_TrusteeScope = N'%TrusteeScope%'

 

The SELECT statement will include the following lines which JOIN the trustee syntax to a database object, which in this example was the vComputer view which was given an alias of "i" :-

 

JOIN dbo.ScopeMembership sm ON sm.[ResourceGuid] = i.Guid

AND sm.[ScopeCollectionGuid] IN

(SELECT * FROM dbo.fnGetTrusteeScopeCollections (@v1_TrusteeScope))

Connect Etiquette: "Mark as Solution" those posts which resolve your problem, and give a thumbs up to useful comments, articles and downloads.