get user's file permissions in a dir 
Author Message
 get user's file permissions in a dir

Tom,

Have a look at the GetAttr function.

Peter

Quote:

>Does anyone know how to find out if the user has certain file
>permissions in a given directory?  ie. create, edit, rename, delete

>Thanks,
>Tom



Wed, 31 Jan 2001 03:00:00 GMT  
 get user's file permissions in a dir
Thanks for replying, Peter.

I'm sorry but I don't see how that function gives me what I want.
Don't I need more than the file's readonly attribute?  For example, I
may be able to update files, but not delete them.

 Am I missing something?

Tom

On Sat, 15 Aug 1998 07:08:08 +0100, "Peter Beach"

Quote:

>Tom,

>Have a look at the GetAttr function.

>Peter


>>Does anyone know how to find out if the user has certain file
>>permissions in a given directory?  ie. create, edit, rename, delete

>>Thanks,
>>Tom



Wed, 31 Jan 2001 03:00:00 GMT  
 get user's file permissions in a dir
Tom,

I'm not an expert on file security.  Logically if a user has write access to
a file (as would be needed for update) they can write the file down to a 4
byte size which says "HAHA".  All the Windows API calls I have seen involve
either write access or read access, a combination of the two together with
sharing options.  If you can write to the file you can effectively delete
it.

Maybe your problem is more complicated?

Peter

Quote:

>Thanks for replying, Peter.

>I'm sorry but I don't see how that function gives me what I want.
>Don't I need more than the file's readonly attribute?  For example, I
>may be able to update files, but not delete them.

> Am I missing something?

>Tom



Wed, 31 Jan 2001 03:00:00 GMT  
 get user's file permissions in a dir
Peter,

I'm not trying to enforce security - I'm trying to not get tripped up
by it.  Before allowing a user to switch from, say, "read-only" mode
to "read/write" mode, I would like to verify that the user has the
proper permissions to create, update, rename, and delete files in the
data dir.  It's not preferred to let them go for a while and then get
an ugly error message when they try something and the network says,
"No!"  I could manipulate a temp file in the target dir, but I hope
there is a straightforward way to query this from VB.

Tom

On Sat, 15 Aug 1998 21:31:32 +0100, "Peter Beach"

Quote:

>Tom,

>I'm not an expert on file security.  Logically if a user has write access to
>a file (as would be needed for update) they can write the file down to a 4
>byte size which says "HAHA".  All the Windows API calls I have seen involve
>either write access or read access, a combination of the two together with
>sharing options.  If you can write to the file you can effectively delete
>it.

>Maybe your problem is more complicated?

>Peter



Fri, 02 Feb 2001 03:00:00 GMT  
 get user's file permissions in a dir
Someone named Tom said...

Quote:
>Does anyone know how to find out if the user has certain file
>permissions in a given directory?  ie. create, edit, rename, delete

>Thanks,
>Tom

I am not sure how what you mean.  I assume you mean the NTFS level security
in
Windows NT where you can set actual file permissions.  You want to see if a
user has
permission to access a file and what level the user has.  Well
then...welcome the wonderful
world of pointers. There are several APIs that can list the security info
for a file.

GetNamedSecurityInfo( Many params most of which are pointers)
GetSecurityInfo(Many params most of which are pointers);
GetSecurityInfoEx( Many params most of which are pointers );

And with the RtlMoveMemory API you can actually use these pointers in VB.
However, if it's at all possible wrap these in a C dll. The pisser is that
sometimes the
user does not have permission to view his own permissions :)  If you want to
use these you should
understand the Microsoft? Windows NT? version 4.0 access-control model. I am
not going to
give the full code as in reality it's quite lengthy.  In addition most of
the APIs that you will need are
not in the Win32 SDK, here is the URL where I became a wise man, hip to this
info...
http://premium.microsoft.com/msdn/library/

SDK Documentation-->Platform SDK-->Windows Base Services-->Security-->Access
Control

So in conclusion, while it is tricky to view this info, it can be done, I've
done it..and so can you.
I would offer to donate a sample..but for the next month or so I'm stuck in
Win95 for as far as the
eye can see..no NT to be found.  But when I see NT again, I'll try and write
a nice little class.

I hope I helped more than frustrated..

patrickj AT itis DOT com
Consultant
Maxim Group



Sat, 03 Feb 2001 03:00:00 GMT  
 get user's file permissions in a dir
On Tue, 18 Aug 1998 11:21:03 -0500, "Patrick Escarcega"

Quote:

>I hope I helped more than frustrated..

Probably good chunks of both...
(But done quite eloquently, I might add)

Tom



Sat, 03 Feb 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. get user's file permissions in a dir

2. Need help creating user dir., then setting specific permissions for it

3. help switching file names or getting list of files in a dir

4. Listing Dir's inside Dir's

5. eg for set/get permissions on file, dir

6. Getting list of users that have permissions on a share

7. create nt user and share it's home dir

8. VB 6 iNet DIR Getting File Date/Time

9. Permissions To Another User's Folders

10. Problem with user's permissions in mdb via VB5

11. How get User's permission on a Share

12. Permission denied getting file from server

 

 
Powered by phpBB® Forum Software