Results 1 to 7 of 7

Thread: Obtaining security permissions on a folder

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2007
    Location
    Middletown, CT
    Posts
    948

    Obtaining security permissions on a folder

    I've searched the forums, and it seems a lot of people are recommending GetAttr. Will GetAttr be able to read the NT security permissions of a given folder? For instance, the folder may not be read-only, but the user may not have the "create files/folders" permission, which would make it read-only in a sense. Will GetAttr be able to detect this?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Obtaining security permissions on a folder

    Nope, they are different things entirely.

    What you can use is the GetFileSecurity API.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2007
    Location
    Middletown, CT
    Posts
    948

    Re: Obtaining security permissions on a folder

    I'd be trying to create a file in a directory and want to check to make sure I can before doing so. Is there anything besides those two functions I should consider?

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Obtaining security permissions on a folder

    There is one other thing I can think of which is Share permissions - but they only apply if it is a shared folder you are working with (and have connected to it as a share, as opposed to via the parent folders etc). Unfortunately I don't know how you can detect the permissions there.

    I would suggest creating a test file, but then you may not be able to Delete or Edit it!

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2007
    Location
    Middletown, CT
    Posts
    948

    Re: Obtaining security permissions on a folder

    True. I'll just stick with the security permissions API for now. I'll write a quick sub and test it. I'll leave the thread open until I know for sure that it works.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2007
    Location
    Middletown, CT
    Posts
    948

    Re: Obtaining security permissions on a folder

    It looks like GetFileSecurity is VERY complicated, or at least the example on allapi is complicated. Would it be possible to get a bit of a hand with how I would just determine whether a file has read/write permissions?

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Obtaining security permissions on a folder

    It looks like this version might be easier to use: http://www.vbforums.com/showthread.php?t=81966

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width