[eit.commands.command] add support for unprivileged commands execution
This commit is contained in:
@@ -31,6 +31,8 @@ class EitCommand(object):
|
||||
ALIASES = []
|
||||
# Set this to True if command is a catch-all (fallback)
|
||||
CATCH_ALL = False
|
||||
# Allow unprivileged access ?
|
||||
ALLOW_UNPRIVILEGED = False
|
||||
|
||||
def __init__(self, args):
|
||||
self._args = args
|
||||
|
||||
@@ -69,8 +69,9 @@ def main():
|
||||
allowed = True
|
||||
if os.getuid() != 0 and \
|
||||
cmd_class is not catch_all:
|
||||
cmd_class = catch_all
|
||||
allowed = False
|
||||
if not cmd_class.ALLOW_UNPRIVILEGED:
|
||||
cmd_class = catch_all
|
||||
allowed = False
|
||||
|
||||
cmd_obj = cmd_class(args)
|
||||
func, func_args = cmd_obj.parse()
|
||||
|
||||
Reference in New Issue
Block a user