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