mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
enable APIs command for signjwt
This commit is contained in:
@@ -7168,6 +7168,20 @@ def getGAMProjectFile(filepath):
|
|||||||
return c.decode(UTF8)
|
return c.decode(UTF8)
|
||||||
|
|
||||||
|
|
||||||
|
def signjwt_enable_apis():
|
||||||
|
try:
|
||||||
|
creds, project_id = google.auth.default()
|
||||||
|
except google.auth.exceptions.DefaultCredentialsError as e:
|
||||||
|
controlflow.system_error_exit(2, e)
|
||||||
|
httpObj = transport.AuthorizedHttp(
|
||||||
|
creds, transport.create_http(cache=GM_Globals[GM_CACHE_DIR]))
|
||||||
|
GAMProjectAPIs = getGAMProjectFile('project-apis.txt').splitlines()
|
||||||
|
enableGAMProjectAPIs(GAMProjectAPIs,
|
||||||
|
httpObj,
|
||||||
|
projectID=project_id,
|
||||||
|
checkEnabled=True)
|
||||||
|
|
||||||
|
|
||||||
def enableGAMProjectAPIs(GAMProjectAPIs,
|
def enableGAMProjectAPIs(GAMProjectAPIs,
|
||||||
httpObj,
|
httpObj,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -12132,6 +12146,11 @@ def ProcessGAMCommand(args):
|
|||||||
yk.serial_number = yk.get_serial_number()
|
yk.serial_number = yk.get_serial_number()
|
||||||
yk.reset_piv()
|
yk.reset_piv()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
elif command == 'enable':
|
||||||
|
enable_what = sys.argv[2].lower().replace('_', '')
|
||||||
|
if enable_what in ['api', 'apis']:
|
||||||
|
signjwt_enable_apis()
|
||||||
|
sys.exit(0)
|
||||||
users = getUsersToModify()
|
users = getUsersToModify()
|
||||||
command = sys.argv[3].lower()
|
command = sys.argv[3].lower()
|
||||||
if command == 'print' and len(sys.argv) == 4:
|
if command == 'print' and len(sys.argv) == 4:
|
||||||
|
|||||||
Reference in New Issue
Block a user