Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #11689

Re: How to Check Write Access of a Folder on Windows

Date 2011-08-17 16:47 +0100
From Tim Golden <mail@timgolden.me.uk>
Subject Re: How to Check Write Access of a Folder on Windows
References <CAJo85JYdEG=wudsC8fs_CUAAHaOy7=Zi5MDc2JeFLW+U_kTrFw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.132.1313596073.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 16/08/2011 13:38, Ayaskant Swain wrote:
> Hi Tim,
>
> Thanks for your reply. It seems this issue is related to python bug
> -http://bugs.python.org/issue2528
> But the patch code looks complex to me. I want to make changes only
> in my python script which will read an user given directory path&
> check it's write access. What is the use of posixmodule.c file?

Well.. the changes to posixmodule.c, had they been accepted, would
have meant that a call to os.access on Windows would have done the
work to determine whether or not you truly had access. As it is,
that issue has been "demoted" to a doc-and-deprecate bug.

So you either need to do the same sequence of actions (more or
less) or to simulate its effect. Certainly you can retrieve the
ACEs in the DACL via the GetFileSecurity call, and you're then
going to have to compare the effect of all the (possibly
quite complex and inherited) ACEs on the logged-in user's ability
to view the directory.

The ACEs might refer directly to the user or (more likely)
indirectly via groups, including builtins like "Domain Users"
or "Administrators". So you'd have to work out whether your user
was in one of those groups, possibly indirectly as groups can
contain groups.

Certainly all of this is do-able but it won't be trivial. I'm
sorry I can't be more helpful but I haven't had a need for this
functionality myself (even the patch to issue2528 was in response
to someone else's need similar to yours).

TJG

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to Check Write Access of a Folder on Windows Tim Golden <mail@timgolden.me.uk> - 2011-08-17 16:47 +0100

csiph-web