Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Checking access rights when presenting Link Collection


I'm using a Link Collection property and have made  a usercontrol that adds custom rendering of the links.

One thing I wan't to do is display a "Secure file icon" if a document resides in a folder that "Everyone" doesn't have read access to.

 I tried doing this with

UnifiedPathInfo pathInfo = new UnifiedPathInfo(path);
AccessControlList acl = pathInfo.Access;
return acl.QueryDistinctAccess(AccessLevel.Read);

But it didn'w work. How can I accomplish this?

Per N

Dec 03, 2008 11:21
as input to the above code I set the path variable to linkitem.href;
Dec 03, 2008 11:33

dont know if this works but try:

return pathInfo.Access.Exists("Everyone")

 -Kjetil Simensen

Dec 03, 2008 11:36

It didn't work.

I tried the below code. If i try to get a file in a folder where everyone has no access I get an exception. That works for a anonymous user. But as soon as I log in I dont get the exception.

 I want to always display the icon if the group Everyone has no access.

// UnifiedFile file = HostingEnvironment.VirtualPathProvider.GetFile(path) as UnifiedFile;

// AccessLevel l = file.QueryAccess();


//catch (UnauthorizedAccessException ex)

// return false;


Dec 03, 2008 17:20


Its the Directory in the filesystem that has access right.

In CMS 5 if you want to check if all users have acces to a file you can use this code 

file.Parent.ACL.QueryDistinctAccess(PrincipalInfo.AnonymousPrincipal, AccessLevel.Read)


Dec 03, 2008 21:28

Thank you for the answer Anders I figured it out last night. It's also possible to do the below to check the the directotry directly without trying to access the file.

UnifiedDirectory dir = HostingEnvironment.VirtualPathProvider.GetDirectory(path) as UnifiedDirectory.



Dec 04, 2008 8:19
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.