mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 09:51:36 +00:00
I suggest match_users instead of if_users (#980)
* I suggest match_users instead of if_users * Allow if_users or match_users
This commit is contained in:
@@ -1050,7 +1050,7 @@ The listlimit <Number> argument limits the number of recent users, time ranges a
|
||||
The start <Date> and end <Date> arguments filter the time ranges.
|
||||
Delimiter defaults to comma.
|
||||
|
||||
gam update mobile <MobileID> action <MobileAction>
|
||||
gam update mobile <MobileID>|query:<QueryMobile> action <MobileAction> [doit] [if_users|match_users <UserTypeEntity>]
|
||||
gam delete mobile <MobileID>
|
||||
gam info mobile <MobileID>
|
||||
gam print mobile [todrive] [(query <QueryMobile>)|(queries <QueryMobileList>)] [basic|full] [orderby <MobileOrderByFieldName> [ascending|descending]]
|
||||
|
||||
10
src/gam.py
10
src/gam.py
@@ -9693,7 +9693,7 @@ def doUpdateCros():
|
||||
def doUpdateMobile():
|
||||
cd = buildGAPIObject('directory')
|
||||
resourceIds = sys.argv[3]
|
||||
only_users = None
|
||||
match_users = None
|
||||
doit = False
|
||||
if resourceIds[:6] == 'query:':
|
||||
query = resourceIds[6:]
|
||||
@@ -9714,8 +9714,8 @@ def doUpdateMobile():
|
||||
if body['action'] not in ['admin_remote_wipe', 'admin_account_wipe', 'approve', 'block', 'cancel_remote_wipe_then_activate', 'cancel_remote_wipe_then_block']:
|
||||
systemErrorExit(2, 'action must be one of wipe, wipeaccount, approve, block, cancel_remote_wipe_then_activate, cancel_remote_wipe_then_block; got %s' % body['action'])
|
||||
i += 2
|
||||
elif myarg == 'ifusers':
|
||||
only_users = getUsersToModify(entity_type=sys.argv[i+1].lower(), entity=sys.argv[i+2])
|
||||
elif myarg in ['ifusers', 'matchusers']:
|
||||
match_users = getUsersToModify(entity_type=sys.argv[i+1].lower(), entity=sys.argv[i+2])
|
||||
i += 3
|
||||
elif myarg == 'doit':
|
||||
doit = True
|
||||
@@ -9733,8 +9733,8 @@ def doUpdateMobile():
|
||||
describe_as = 'Would perform'
|
||||
for device in devices:
|
||||
device_user = device.get('email', [''])[0]
|
||||
if only_users and device_user not in only_users:
|
||||
print('Skipping device for user %s that did not match if_users argument' % device_user)
|
||||
if match_users and device_user not in match_users:
|
||||
print('Skipping device for user %s that did not match match_users argument' % device_user)
|
||||
else:
|
||||
print('%s %s on user %s device %s' % (describe_as, body['action'], device_user, device['resourceId']))
|
||||
if doit:
|
||||
|
||||
Reference in New Issue
Block a user