mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-29 18:31:38 +00:00
Updated gam create|update adminrole
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
7.34.01
|
||||||
|
|
||||||
|
Updated `gam create|update adminrole` to handle the following errors:
|
||||||
|
```
|
||||||
|
ERROR: 400: invalid - Invalid Role privileges
|
||||||
|
ERROR: 400: required - Required parameter: [resource.privileges[n].service_id]
|
||||||
|
```
|
||||||
|
|
||||||
7.34.00
|
7.34.00
|
||||||
|
|
||||||
Added variable `csv_output_header_required` to `gam.cfg` that is a comma separated list of `<Strings>`
|
Added variable `csv_output_header_required` to `gam.cfg` that is a comma separated list of `<Strings>`
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
||||||
__version__ = '7.34.00'
|
__version__ = '7.34.01'
|
||||||
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
||||||
|
|
||||||
# pylint: disable=wrong-import-position
|
# pylint: disable=wrong-import-position
|
||||||
@@ -16992,12 +16992,13 @@ def doCreateUpdateAdminRoles():
|
|||||||
if not updateCmd:
|
if not updateCmd:
|
||||||
result = callGAPI(cd.roles(), 'insert',
|
result = callGAPI(cd.roles(), 'insert',
|
||||||
throwReasons=[GAPI.BAD_REQUEST, GAPI.CUSTOMER_NOT_FOUND,
|
throwReasons=[GAPI.BAD_REQUEST, GAPI.CUSTOMER_NOT_FOUND,
|
||||||
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED]+[GAPI.DUPLICATE],
|
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED]+[GAPI.DUPLICATE, GAPI.INVALID, GAPI.REQUIRED],
|
||||||
customer=GC.Values[GC.CUSTOMER_ID], body=body, fields=fieldsList)
|
customer=GC.Values[GC.CUSTOMER_ID], body=body, fields=fieldsList)
|
||||||
else:
|
else:
|
||||||
result = callGAPI(cd.roles(), 'patch',
|
result = callGAPI(cd.roles(), 'patch',
|
||||||
throwReasons=[GAPI.BAD_REQUEST, GAPI.CUSTOMER_NOT_FOUND,
|
throwReasons=[GAPI.BAD_REQUEST, GAPI.CUSTOMER_NOT_FOUND,
|
||||||
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED]+[GAPI.NOT_FOUND, GAPI.FAILED_PRECONDITION, GAPI.CONFLICT],
|
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED]+[GAPI.NOT_FOUND, GAPI.FAILED_PRECONDITION,
|
||||||
|
GAPI.CONFLICT, GAPI.INVALID, GAPI.REQUIRED],
|
||||||
customer=GC.Values[GC.CUSTOMER_ID], roleId=roleId, body=body, fields=fieldsList)
|
customer=GC.Values[GC.CUSTOMER_ID], roleId=roleId, body=body, fields=fieldsList)
|
||||||
if not csvPF:
|
if not csvPF:
|
||||||
entityActionPerformed([Ent.ADMIN_ROLE, f"{result['roleName']}({result['roleId']})"])
|
entityActionPerformed([Ent.ADMIN_ROLE, f"{result['roleName']}({result['roleId']})"])
|
||||||
@@ -17015,7 +17016,7 @@ def doCreateUpdateAdminRoles():
|
|||||||
row.update(addCSVData)
|
row.update(addCSVData)
|
||||||
row['JSON'] = json.dumps(cleanJSON(result), ensure_ascii=False, sort_keys=True)
|
row['JSON'] = json.dumps(cleanJSON(result), ensure_ascii=False, sort_keys=True)
|
||||||
csvPF.WriteRowNoFilter(row)
|
csvPF.WriteRowNoFilter(row)
|
||||||
except GAPI.duplicate as e:
|
except (GAPI.duplicate, GAPI.invalid, GAPI.required) as e:
|
||||||
entityActionFailedWarning([Ent.ADMIN_ROLE, f"{body['roleName']}"], str(e))
|
entityActionFailedWarning([Ent.ADMIN_ROLE, f"{body['roleName']}"], str(e))
|
||||||
except (GAPI.notFound, GAPI.failedPrecondition, GAPI.conflict) as e:
|
except (GAPI.notFound, GAPI.failedPrecondition, GAPI.conflict) as e:
|
||||||
entityActionFailedWarning([Ent.ADMIN_ROLE, roleId], str(e))
|
entityActionFailedWarning([Ent.ADMIN_ROLE, roleId], str(e))
|
||||||
|
|||||||
Reference in New Issue
Block a user