Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
dont know if this works but try:
return pathInfo.Access.Exists("Everyone")
-Kjetil Simensen
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.
//try
//{
// UnifiedFile file = HostingEnvironment.VirtualPathProvider.GetFile(path) as UnifiedFile;
// AccessLevel l = file.QueryAccess();
//}
//catch (UnauthorizedAccessException ex)
//{
// return false;
//}
Hi
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)
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.
dir.ACL.QueryDistinctAccess(PrincipalInfo.AnonymousPrincipal,AccessLevel.REad).
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