mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 18:01:36 +00:00
Added command gam check suspended <UserItem>
Some checks failed
Build and test GAM / build (build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (build, 10, Build Intel Windows, windows-2022) (push) Has been cancelled
Build and test GAM / build (build, 11, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (build, 7, Build Intel MacOS, macos-13) (push) Has been cancelled
Build and test GAM / build (build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (test, 12, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (test, 13, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (test, 14, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (test, 15, Test Python 3.14-dev, ubuntu-24.04, 3.14-dev) (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Push wiki / pushwiki (push) Has been cancelled
Some checks failed
Build and test GAM / build (build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (build, 10, Build Intel Windows, windows-2022) (push) Has been cancelled
Build and test GAM / build (build, 11, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (build, 7, Build Intel MacOS, macos-13) (push) Has been cancelled
Build and test GAM / build (build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (test, 12, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (test, 13, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (test, 14, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (test, 15, Test Python 3.14-dev, ubuntu-24.04, 3.14-dev) (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Push wiki / pushwiki (push) Has been cancelled
This commit is contained in:
@@ -337,6 +337,7 @@ ENTITY_IS_A_GROUP_RC = 22
|
||||
ENTITY_IS_A_GROUP_ALIAS_RC = 23
|
||||
ENTITY_IS_AN_UNMANAGED_ACCOUNT_RC = 24
|
||||
ORGUNIT_NOT_EMPTY_RC = 25
|
||||
USER_SUSPENDED_RC = 26
|
||||
CHECK_USER_GROUPS_ERROR_RC = 29
|
||||
ORPHANS_COLLECTED_RC = 30
|
||||
# Warnings/Errors
|
||||
@@ -44337,6 +44338,28 @@ def doUndeleteUsers():
|
||||
def doUndeleteUser():
|
||||
undeleteUsers(getStringReturnInList(Cmd.OB_USER_ITEM))
|
||||
|
||||
# gam check suspended <UserItem>
|
||||
def doCheckUserSuspended():
|
||||
cd = buildGAPIObject(API.DIRECTORY)
|
||||
user = getEmailAddress()
|
||||
checkForExtraneousArguments()
|
||||
try:
|
||||
result = callGAPI(cd.users(), 'get',
|
||||
throwReasons=GAPI.USER_GET_THROW_REASONS,
|
||||
userKey=user, fields='suspended,suspensionReason', projection='basic')
|
||||
except (GAPI.userNotFound, GAPI.domainNotFound, GAPI.domainCannotUseApis, GAPI.forbidden):
|
||||
entityDoesNotExistExit(Ent.USER, user)
|
||||
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
|
||||
accessErrorExit(cd)
|
||||
kvList = [Ent.Singular(Ent.USER), user]
|
||||
up = 'suspended'
|
||||
kvList.extend([UProp.PROPERTIES[up][UProp.TITLE], result[up]])
|
||||
if result[up]:
|
||||
up = 'suspensionReason'
|
||||
kvList.extend([UProp.PROPERTIES[up][UProp.TITLE], result[up]])
|
||||
setSysExitRC(USER_SUSPENDED_RC)
|
||||
printKeyValueList(kvList)
|
||||
|
||||
# gam <UserTypeEntity> suspend users [noactionifalias]
|
||||
# gam <UserTypeEntity> unsuspend users [noactionifalias]
|
||||
def suspendUnsuspendUsers(entityList):
|
||||
@@ -76554,6 +76577,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
|
||||
Cmd.ARG_USERINVITATION: doCheckCIUserInvitations,
|
||||
Cmd.ARG_ISINVITABLE: doCheckCIUserInvitations,
|
||||
Cmd.ARG_ORG: doCheckOrgUnit,
|
||||
Cmd.ARG_SUSPENDED: doCheckUserSuspended,
|
||||
}
|
||||
),
|
||||
'clear':
|
||||
|
||||
@@ -777,6 +777,7 @@ class GamCLArgs():
|
||||
ARG_STORAGEBUCKETS = 'storagebuckets'
|
||||
ARG_STORAGEFILE = 'storagefile'
|
||||
ARG_STORAGEFILES = 'storagefiles'
|
||||
ARG_SUSPENDED = 'suspended'
|
||||
ARG_SVCACCT = 'svcacct'
|
||||
ARG_SVCACCTS = 'svcaccts'
|
||||
ARG_TASK = 'task'
|
||||
|
||||
Reference in New Issue
Block a user