MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / CheckEnforcementsCommand

Class CheckEnforcementsCommand

keepercommander/commands/utils.py:1856–1894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1854
1855
1856class CheckEnforcementsCommand(Command):
1857 def get_parser(self):
1858 return check_enforcements_parser
1859
1860 def is_authorised(self):
1861 return False
1862
1863 def execute(self, params, **kwargs):
1864 if params.enforcements:
1865 if 'enterprise_invited' in params.enforcements:
1866 logging.info('You\'ve been invited to join {0}.'.format(params.enforcements['enterprise_invited']))
1867 action = user_choice('A(ccept)/D(ecline)/I(gnore)?: ', 'adi')
1868 action = action.lower()
1869 if action == 'a':
1870 action = 'accept'
1871 elif action == 'd':
1872 action = 'decline'
1873 if action in ['accept', 'decline']:
1874 e_rq = {
1875 'command': '{0}_enterprise_invite'.format(action)
1876 }
1877 if action == 'accept':
1878 verification_code = input('Please enter the verification code sent via email: ')
1879 if verification_code:
1880 e_rq['verification_code'] = verification_code
1881 else:
1882 e_rq = None
1883 if e_rq:
1884 try:
1885 api.communicate(params, e_rq)
1886 logging.info('%s enterprise invite', 'Accepted' if action == 'accept' else 'Declined')
1887 #TODO reload enterprise settings
1888 except Exception as e:
1889 logging.error('Enterprise %s failure: %s', action, e)
1890
1891 share_account_by = params.get_share_account_timestamp()
1892 if share_account_by is not None:
1893 account_transfer_command = AcceptTransferCommand()
1894 account_transfer_command.execute(params, **kwargs)
1895
1896
1897class AcceptTransferCommand(Command):

Callers 1

register_commandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected