~nataliabidart/ubuntuone-client/stable-3-0-update-2.99.91.1

« back to all changes in this revision

Viewing changes to ubuntuone/platform/windows/os_helper.py

  • Committer: Natalia B. Bidart
  • Date: 2012-03-27 15:41:57 UTC
  • mfrom: (1159.1.58 ubuntuone-client)
  • Revision ID: natalia.bidart@canonical.com-20120327154157-np77rwn8oowq71r2
- Updating from trunk up to revno 1217.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import stat
24
24
import sys
25
25
 
 
26
from platform import version
26
27
from contextlib import contextmanager
27
28
from functools import wraps
28
29
 
872
873
 
873
874
def is_root():
874
875
    """Return if the user is running as root."""
875
 
    # This solution works on Windows XP, Vista and 7
 
876
    # On Windows XP (v5.1), always return False. Nearly all users run with
 
877
    # Administrator access, so this would restrict too many users.
 
878
    # On Vista (v6.0) and 7 (v6.1), return the real Administrator value.
876
879
    # The MSDN docs say this may go away in a later version, but look at what
877
880
    # the alternative is: http://bit.ly/rXbIwc
878
 
    return shell.IsUserAnAdmin()
 
881
    is_xp = version()[0] == "5"
 
882
    return False if is_xp else shell.IsUserAnAdmin()
879
883
 
880
884
 
881
885
@windowspath()