Vernon Cole wrote:
Tim,
  You Da Man!
Vernon

based on your suggestion, I have:
<code>
import win32security

def testMemberOf(GROUP_NAME):
    try:
sid, system, type = win32security.LookupAccountName(None, GROUP_NAME)
    except:
        raise ValueError, '"%s" is not a valid group name'%GROUP_NAME
    return win32security.CheckTokenMembership(None, sid)
</code>

Glad it helped. One thing -- which I imagine you
will have thought of for yourself, but just in
case... -- is that catching *all* exceptions might
mask something more than a misspelt group name.
But, clearly, the effect is the same: you can't
do the check against the group.

TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to