mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
More bug/pylint cleanup (#1258)
* More bug/pylint cleanup * pylint cleanup groups.py * Update GamCommands.txt
This commit is contained in:
@@ -1027,7 +1027,10 @@ The following attributes are equivalent:
|
|||||||
(colorindex|colorid <EventColorIndex>)
|
(colorindex|colorid <EventColorIndex>)
|
||||||
(description <String>)|
|
(description <String>)|
|
||||||
(end (allday <Date>)|<Time>)|
|
(end (allday <Date>)|<Time>)|
|
||||||
|
(guestscaninviteothers <Boolean>)|
|
||||||
guestscantinviteothers|
|
guestscantinviteothers|
|
||||||
|
(guestscanmodify <Boolean>)|
|
||||||
|
(guestscanseeothers <Boolean>)|
|
||||||
guestscantseeothers|
|
guestscantseeothers|
|
||||||
hangoutsmeet|
|
hangoutsmeet|
|
||||||
(location <String>)|
|
(location <String>)|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import csv
|
|
||||||
|
|
||||||
import gam
|
import gam
|
||||||
from gam.var import *
|
from gam.var import *
|
||||||
from gam import controlflow
|
from gam import controlflow
|
||||||
@@ -9,7 +7,6 @@ from gam import utils
|
|||||||
from gam.gapi import errors as gapi_errors
|
from gam.gapi import errors as gapi_errors
|
||||||
from gam.gapi import cloudidentity as gapi_cloudidentity
|
from gam.gapi import cloudidentity as gapi_cloudidentity
|
||||||
from gam.gapi.directory import customer as gapi_directory_customer
|
from gam.gapi.directory import customer as gapi_directory_customer
|
||||||
from gam.gapi.directory import groups as gapi_directory_groups
|
|
||||||
|
|
||||||
|
|
||||||
def create():
|
def create():
|
||||||
@@ -583,14 +580,13 @@ def update():
|
|||||||
name = membership_email_to_id(ci, parent, users_email[0])
|
name = membership_email_to_id(ci, parent, users_email[0])
|
||||||
addRoles = []
|
addRoles = []
|
||||||
removeRoles = []
|
removeRoles = []
|
||||||
new_role = {'role': role}
|
|
||||||
current_roles = gapi.call(ci.groups().memberships(),
|
current_roles = gapi.call(ci.groups().memberships(),
|
||||||
'get',
|
'get',
|
||||||
name=name,
|
name=name,
|
||||||
fields='roles').get('roles', [])
|
fields='roles').get('roles', [])
|
||||||
current_roles = [role['name'] for role in current_roles]
|
current_roles = [role['name'] for role in current_roles]
|
||||||
for crole in current_roles:
|
for crole in current_roles:
|
||||||
if crole != ROLE_MEMBER and crole != role:
|
if crole not in {ROLE_MEMBER, role}:
|
||||||
removeRoles.append(crole)
|
removeRoles.append(crole)
|
||||||
if role not in current_roles:
|
if role not in current_roles:
|
||||||
addRoles.append({'name': role})
|
addRoles.append({'name': role})
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from gam.var import *
|
from gam.var import *
|
||||||
from gam import controlflow
|
|
||||||
from gam import gapi
|
from gam import gapi
|
||||||
from gam.gapi import directory as gapi_directory
|
from gam.gapi import directory as gapi_directory
|
||||||
from gam import utils
|
from gam import utils
|
||||||
|
|||||||
@@ -221,11 +221,11 @@ def info_member():
|
|||||||
cd = gapi_directory.build()
|
cd = gapi_directory.build()
|
||||||
memberKey = gam.normalizeEmailAddressOrUID(sys.argv[3])
|
memberKey = gam.normalizeEmailAddressOrUID(sys.argv[3])
|
||||||
groupKey = gam.normalizeEmailAddressOrUID(sys.argv[4])
|
groupKey = gam.normalizeEmailAddressOrUID(sys.argv[4])
|
||||||
info = gapi.call(cd.members(),
|
member_info = gapi.call(cd.members(),
|
||||||
'get',
|
'get',
|
||||||
memberKey=memberKey,
|
memberKey=memberKey,
|
||||||
groupKey=groupKey)
|
groupKey=groupKey)
|
||||||
display.print_json(info)
|
display.print_json(member_info)
|
||||||
|
|
||||||
|
|
||||||
GROUP_ARGUMENT_TO_PROPERTY_TITLE_MAP = {
|
GROUP_ARGUMENT_TO_PROPERTY_TITLE_MAP = {
|
||||||
@@ -1146,7 +1146,7 @@ def update():
|
|||||||
i += 2
|
i += 2
|
||||||
elif myarg == 'admincreated':
|
elif myarg == 'admincreated':
|
||||||
use_cd_api = True
|
use_cd_api = True
|
||||||
cd_body['adminCreated'] = getBoolean(sys.argv[i + 1], myarg)
|
cd_body['adminCreated'] = gam.getBoolean(sys.argv[i + 1], myarg)
|
||||||
i += 2
|
i += 2
|
||||||
elif myarg == 'getbeforeupdate':
|
elif myarg == 'getbeforeupdate':
|
||||||
gs_get_before_update = True
|
gs_get_before_update = True
|
||||||
@@ -1242,5 +1242,3 @@ def getGroupAttrValue(myarg, value, gs_object, gs_body, function):
|
|||||||
gs_body[attrib] = value
|
gs_body[attrib] = value
|
||||||
return
|
return
|
||||||
controlflow.invalid_argument_exit(myarg, f'gam {function} group')
|
controlflow.invalid_argument_exit(myarg, f'gam {function} group')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,16 +23,16 @@ def delete():
|
|||||||
def info():
|
def info():
|
||||||
cd = gapi_directory.build()
|
cd = gapi_directory.build()
|
||||||
resourceId = sys.argv[3]
|
resourceId = sys.argv[3]
|
||||||
info = gapi.call(cd.mobiledevices(),
|
device_info = gapi.call(cd.mobiledevices(),
|
||||||
'get',
|
'get',
|
||||||
customerId=GC_Values[GC_CUSTOMER_ID],
|
customerId=GC_Values[GC_CUSTOMER_ID],
|
||||||
resourceId=resourceId)
|
resourceId=resourceId)
|
||||||
if 'deviceId' in info:
|
if 'deviceId' in info:
|
||||||
info['deviceId'] = info['deviceId'].encode('unicode-escape').decode(
|
device_info['deviceId'] = device_info['deviceId'].encode('unicode-escape').decode(
|
||||||
UTF8)
|
UTF8)
|
||||||
attrib = 'securityPatchLevel'
|
attrib = 'securityPatchLevel'
|
||||||
if attrib in info and int(info[attrib]):
|
if attrib in info and int(device_info[attrib]):
|
||||||
info[attrib] = utils.formatTimestampYMDHMS(info[attrib])
|
device_info[attrib] = utils.formatTimestampYMDHMS(device_info[attrib])
|
||||||
display.print_json(info)
|
display.print_json(info)
|
||||||
|
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ def print_():
|
|||||||
|
|
||||||
|
|
||||||
def update():
|
def update():
|
||||||
cd = gapi_directory.build
|
cd = gapi_directory.build()
|
||||||
resourceIds = sys.argv[3]
|
resourceIds = sys.argv[3]
|
||||||
match_users = None
|
match_users = None
|
||||||
doit = False
|
doit = False
|
||||||
@@ -235,5 +235,3 @@ def update():
|
|||||||
resourceId=device['resourceId'],
|
resourceId=device['resourceId'],
|
||||||
body=body,
|
body=body,
|
||||||
customerId=GC_Values[GC_CUSTOMER_ID])
|
customerId=GC_Values[GC_CUSTOMER_ID])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def flatten_privilege_list(privs, parent=None):
|
|||||||
parent=priv['privilegeName'])
|
parent=priv['privilegeName'])
|
||||||
priv['children'] = ' '.join(
|
priv['children'] = ' '.join(
|
||||||
[child['privilegeName'] for child in children])
|
[child['privilegeName'] for child in children])
|
||||||
del (priv['childPrivileges'])
|
del priv['childPrivileges']
|
||||||
flat_privs = flat_privs + children
|
flat_privs = flat_privs + children
|
||||||
flat_privs.append(priv)
|
flat_privs.append(priv)
|
||||||
return flat_privs
|
return flat_privs
|
||||||
|
|||||||
@@ -28,5 +28,3 @@ def turn_off_2sv(users):
|
|||||||
'turnOff',
|
'turnOff',
|
||||||
soft_errors=True,
|
soft_errors=True,
|
||||||
userKey=user)
|
userKey=user)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user