Access rights on an UnifiedFile

I have added a file to a directory handled by the VirtualPathVersioningProvider and removed the access rights for everyone. Then I'm trying to check the access rights on the file (without using a try/catch of course!) before trying to access it. My first guess was VirtualPathUnifiedProvider.HasAccessToVirtualPath( string virtualPath ), but since this method doesn't check with the VirtualPathProvider (just the location authorization), it doesn't work for my purposes. The HostingEnvironment.VirtualPathProvider.GetFile( string virutalPath ) throws an UnauthorizedAccessException, so the Query[Distinct]Access on the UnifiedFile object is pretty much useless to me I guess. Is there something missing in the implementation or do you have some pointers how to implement this? Thx
Aug 29, 2007 10:19
Our implementation is built upon the VirtualPathProvider (VPP) implementation in ASP.NET 2.0. The way to get a file or directory in this API is to use HostingEnvironment.VirtualPathProvider.GetFile( string virutalPath ) or HostingEnvironment.VirtualPathProvider.GetDirectory( string virutalPath ) Our implementation idea is that it should be uniform to program against the file system regardless of the acutal VPP implemenation that serves the file, that is you should not need to make special handling e.g. for the case the serving provider is VirtualPathVersioningProvider. Unfortunately the ASP.NET 2.0 VPP API offers no way to query acess for a file or directory without doing an actual file request. So in your case you need to handle that UnauthorizedAccessException can be thrown.
Aug 29, 2007 14:49
But this also means that you cannot use the UnifiedFileSystem as a "system" folder like your recent article about UFS ( suggests. This since you cannot access a file with different access rights than the current user has without doing some serious impersonation. So no more easy to use xml-settings files in UFS?
Sep 03, 2007 16:15
I see your point and can agree that there might be a need to expose a way to get a file/directory according to a given access level. I have created an issue in our bug system on this. It will though not be included in the release but probably in the next minor realese (SP1). Thank you for your input.
Sep 04, 2007 12:54
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.