Skip to Content
0
Former Member
Jun 02, 2011 at 05:42 PM

Getting list of reports a user has access to

39 Views

Hi,

I'm new to BO and have been trying to figure out a way to get a list of reports a specific user has access to. In reading the documentation in the SDK it appears the only way to do this is to get a list of all reports, loop through them, getting the ObjectPrincipals, looping through that then checking if the objectPrincipal.Name == user.Title.

foreach (InfoObject report in infoObjects)

{

SecurityInfo securityInfo = report.SecurityInfo;

ObjectPrincipals objectPrincipals = securityInfo.ObjectPrincipals;

foreach (ObjectPrincipal objectPrincipal in objectPrincipals)

{

if (objectPrincipal.Name != user.Title) continue;

if (!sortedList.Contains(report.ID))

sortedList.Add(report.ID, report.Title);

}

}

This works, but takes over 90 seconds to generate the list of reports I want, as it is looping through all reports in the CMS (120). My logic is telling me there must be a better way to do this, I just haven't found the answer. It appears that calling securityInfo.ObjectPrincipals is what is taking the most time.

Advice, thoughts, suggestions are all appreciated.

Thanks

James