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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <mail@timgolden.me.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'url:bugs': 0.05; 'bug.': 0.07; 'builtins': 0.07; 'python': 0.08; '(possibly': 0.09; 'effect.': 0.09; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'tim,': 0.09; 'accepted,': 0.16; 'dacl': 0.16; "else's": 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'simulate': 0.16; 'cc:addr:python-list': 0.16; 'possibly': 0.16; 'wrote:': 0.16; 'meant': 0.17; 'subject:Windows': 0.18; 'cc:no real name:2**0': 0.20; 'seems': 0.20; "haven't": 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'indirectly': 0.23; "user's": 0.23; 'code': 0.25; 'helpful': 0.26; 'windows': 0.26; "i'm": 0.27; 'compare': 0.28; 'effect': 0.28; '(even': 0.29; 'looks': 0.29; "won't": 0.29; 'script': 0.29; 'cc:addr:python.org': 0.30; 'tjg': 0.30; 'thanks': 0.30; 'changes': 0.31; 'certainly': 0.32; "can't": 0.33; 'done': 0.34; 'someone': 0.34; 'header:User-Agent:1': 0.34; 'quite': 0.34; 'directory.': 0.34; 'similar': 0.35; 'determine': 0.35; 'subject:How': 0.35; 'url:python': 0.36; 'issue': 0.36; 'skip:" 10': 0.36; 'sequence': 0.37; 'response': 0.37; 'but': 0.37; 'patch': 0.38; 'url:org': 0.38; 'subject:: ': 0.39; 'received:192': 0.39; 'either': 0.39; 'user': 0.39; 'might': 0.40; "it's": 0.40; 'more': 0.60; 'your': 0.61; 'from:addr:mail': 0.64; 'view': 0.67; 'groups.': 0.68; 'subject:Access': 0.84; 'subject:Write': 0.84; 'well..': 0.84; 'to:none': 0.93; 'subject:Check': 0.93
Date Wed, 17 Aug 2011 16:47:49 +0100
From Tim Golden <mail@timgolden.me.uk>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0
MIME-Version 1.0
CC python-list@python.org
Subject Re: How to Check Write Access of a Folder on Windows
References <CAJo85JYdEG=wudsC8fs_CUAAHaOy7=Zi5MDc2JeFLW+U_kTrFw@mail.gmail.com>
In-Reply-To <CAJo85JYdEG=wudsC8fs_CUAAHaOy7=Zi5MDc2JeFLW+U_kTrFw@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.132.1313596073.27778.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1313596073 news.xs4all.nl 23839 [2001:888:2000:d::a6]:48520
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:11689

Show key headers only | 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