I *suppose* that's a way of determining read permissions..
-
/* does the user have read permissions on the file */ try { FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read); using (fs) { fs.Close(); } } catch (Exception){continue;}
And these are people I am actually supposed to work with :^) Ad. Btw the 'user' mentioned here doesn't even exist..this is code running in a Windows NT Service. What the author wants to do (I think :confused:) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under. -
/* does the user have read permissions on the file */ try { FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read); using (fs) { fs.Close(); } } catch (Exception){continue;}
And these are people I am actually supposed to work with :^) Ad. Btw the 'user' mentioned here doesn't even exist..this is code running in a Windows NT Service. What the author wants to do (I think :confused:) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under.ErikDD wrote:
What the author wants to do (I think ) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under.
And your solution would be??
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
ErikDD wrote:
What the author wants to do (I think ) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under.
And your solution would be??
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
Ah, I'd have to admit that I have no idea :-O Afaik, this is one of the things that despite the power of the .NET Framework is still either very difficult or misunderstood. I'd start my search in the FileIOPermission and the WindowsPrincipal/-Identity classes and see where I end up from there. Might be completely wrong though. In any case the above check checks the Windows NT Service account's access, not the requested user's.
-
Ah, I'd have to admit that I have no idea :-O Afaik, this is one of the things that despite the power of the .NET Framework is still either very difficult or misunderstood. I'd start my search in the FileIOPermission and the WindowsPrincipal/-Identity classes and see where I end up from there. Might be completely wrong though. In any case the above check checks the Windows NT Service account's access, not the requested user's.
Clickety[^] :) [edit]I forgot: read the discussion, too...
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us! -
Clickety[^] :) [edit]I forgot: read the discussion, too...
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!Brilliant! I'll give this to my colleague to break his head over ;)