Commit 74d2a784 authored by James Coyle's avatar James Coyle

Fix for user level detection

parent c3b397c1
Pipeline #1259 passed with stages
in 4 seconds
...@@ -97,20 +97,21 @@ def init_register(): ...@@ -97,20 +97,21 @@ def init_register():
def checks(): def checks():
global FORCE global FORCE
if storjstatus_common.get_os_type() == "x": if storjstatus_common.get_os_type() == "linux":
try:
if os.geteuid() != 0:
print_error('Please run this script with root privileges.')
except AttributeError:
print_error('Error checking user access level.')
elif storjstatus_common.get_os_type() == "win":
try:
if ctypes.windll.shell32.IsUserAnAdmin() != 1:
print_error('Please run this script with Administrator privileges.')
except AttributeError:
print_error('Error checking user access level.')
else:
print_error('Unsupported Os type.') print_error('Unsupported Os type.')
try:
if os.geteuid() != 0:
print_error('Please run this script with root privileges.')
except AttributeError:
pass
try:
if ctypes.windll.shell32.IsUserAnAdmin() != 1:
print_error('Please run this script with Administrator privileges.')
except AttributeError:
print_error('Error checking user access level.')
if FORCE == True: if FORCE == True:
print("Forcing regeneration of config and crontab. Note cron times may change.") print("Forcing regeneration of config and crontab. Note cron times may change.")
......
__version__ = '0.3.2' __version__ = '0.3.3'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment