Add initial support for privilege policies
This commit is contained in:
parent
04c285b1cc
commit
a91cd88f3a
1 changed files with 35 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ from core.controllers.ClientVersionController import ClientVersionController
|
|||
from core.controllers.ConfigurationController import ConfigurationController
|
||||
from core.controllers.InvoiceController import InvoiceController
|
||||
from core.controllers.LocationController import LocationController
|
||||
from core.controllers.PrivilegePolicyController import PrivilegePolicyController
|
||||
from core.controllers.ProfileController import ProfileController
|
||||
from core.controllers.SubscriptionController import SubscriptionController
|
||||
from core.controllers.SubscriptionPlanController import SubscriptionPlanController
|
||||
|
|
@ -157,6 +158,17 @@ if __name__ == '__main__':
|
|||
|
||||
application_uninstall_parser = application_subparsers.add_parser('uninstall', parents=[application_base_parser])
|
||||
|
||||
policy_parser = main_subparsers.add_parser('policy')
|
||||
policy_subparsers = policy_parser.add_subparsers(title='subcommands', dest='subcommand')
|
||||
|
||||
policy_base_parser = argparse.ArgumentParser(add_help=False)
|
||||
policy_base_parser.add_argument('--policy', '-p', choices=['privilege'], required=True)
|
||||
|
||||
policy_preview_parser = policy_subparsers.add_parser('preview', parents=[policy_base_parser])
|
||||
policy_instate_parser = policy_subparsers.add_parser('instate', parents=[policy_base_parser])
|
||||
policy_inspect_parser = policy_subparsers.add_parser('inspect', parents=[policy_base_parser])
|
||||
policy_revoke_parser = policy_subparsers.add_parser('revoke', parents=[policy_base_parser])
|
||||
|
||||
get_parser = main_subparsers.add_parser('get')
|
||||
get_subparsers = get_parser.add_subparsers(title='subcommands', dest='subcommand')
|
||||
|
||||
|
|
@ -388,6 +400,29 @@ if __name__ == '__main__':
|
|||
else:
|
||||
main_parser.error('the following argument should be a valid reference: --application/-a')
|
||||
|
||||
elif arguments.command == 'policy':
|
||||
|
||||
if arguments.subcommand is None:
|
||||
policy_parser.print_help()
|
||||
|
||||
elif arguments.policy == 'privilege':
|
||||
|
||||
if arguments.subcommand == 'preview':
|
||||
print(PrivilegePolicyController.preview())
|
||||
|
||||
elif arguments.subcommand == 'instate':
|
||||
PrivilegePolicyController.instate()
|
||||
|
||||
elif arguments.subcommand == 'inspect':
|
||||
|
||||
if PrivilegePolicyController.is_instated():
|
||||
pprint.pp({'status': 'Active'})
|
||||
else:
|
||||
pprint.pp({'status': 'Inactive'})
|
||||
|
||||
elif arguments.subcommand == 'revoke':
|
||||
PrivilegePolicyController.revoke()
|
||||
|
||||
elif arguments.command == 'get':
|
||||
|
||||
if arguments.subcommand is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue