mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-03 22:01:39 +00:00
gcpdetails/scopes cleanup #1891
Some checks failed
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build x86_64 macOS 26, macos-26-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Intel Windows, windows-2025-vs2026) (push) Has been cancelled
Build and test GAM / build (false, build, 14, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 18, Test Python 3.13, ubuntu-24.04, 3.13) (push) Has been cancelled
Build and test GAM / build (false, test, 19, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 20, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Push wiki / pushwiki (push) Has been cancelled
Some checks failed
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build x86_64 macOS 26, macos-26-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Intel Windows, windows-2025-vs2026) (push) Has been cancelled
Build and test GAM / build (false, build, 14, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 18, Test Python 3.13, ubuntu-24.04, 3.13) (push) Has been cancelled
Build and test GAM / build (false, test, 19, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 20, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Push wiki / pushwiki (push) Has been cancelled
This commit is contained in:
@@ -8914,17 +8914,17 @@ gam <UserTypeEntity> delete tokens clientid <ClientID>
|
||||
|
||||
gam <UserTypeEntity> print tokens|token [todrive <ToDriveAttribute>*] [clientid <ClientID>]
|
||||
[usertokencounts|(aggregateusersby|orderby clientid|id|appname|displaytext)]
|
||||
[delimiter <Character>]
|
||||
[delimiter <Character>] [gcpdetails]
|
||||
gam <UserTypeEntity> show tokens|token|3lo|oauth [clientid <ClientID>]
|
||||
[usertokencounts|(aggregateusersby|orderby clientid|id|appname|displaytext)]
|
||||
[delimiter <Character>]
|
||||
[delimiter <Character>] [gcpdetails]
|
||||
gam print tokens|token [todrive <ToDriveAttribute>*] [clientid <ClientID>]
|
||||
[usertokencounts|(aggregateusersby|orderby clientid|id|appname|displaytext)]
|
||||
[delimiter <Character>]
|
||||
[delimiter <Character>] [gcpdetails]
|
||||
[<UserTypeEntity>]
|
||||
gam show tokens|token [clientid <ClientID>]
|
||||
[usertokencounts|(aggregateusersby|orderby clientid|id|appname|displaytext)]
|
||||
[delimiter <Character>]
|
||||
[delimiter <Character>] [gcpdetails]
|
||||
[<UserTypeEntity>]
|
||||
|
||||
# Users - YouTube
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
7.37.00
|
||||
|
||||
Added new client access scopes used by `gam print tokens`.
|
||||
```
|
||||
[*] 52) Resource Manager - Organizations readonly
|
||||
[*] 53) Resource Manager - Projects readonly
|
||||
```
|
||||
|
||||
Added option `gcpdetails` to `gam print tokens` that uses these scopes to get additional project information.
|
||||
|
||||
7.36.03
|
||||
|
||||
Added command to send email replies that causes Gmail to recognize the message
|
||||
|
||||
@@ -11361,8 +11361,8 @@ def doOAuthCreate():
|
||||
for scope in scopesList:
|
||||
subScopes = scope.get('subscopes', [])
|
||||
if ((uscope == scope['scope']) or
|
||||
(uscope.endswith('.action') and 'actiononly' in subscopes) or
|
||||
(uscope.endswith('.readonly') and 'readonly' in subscopes)):
|
||||
(uscope.endswith('.action') and 'actiononly' in subScopes) or
|
||||
(uscope.endswith('.readonly') and 'readonly' in subScopes)):
|
||||
scopes.append(uscope)
|
||||
break
|
||||
else:
|
||||
@@ -72447,22 +72447,25 @@ def _printShowTokens(entityType, users):
|
||||
match = re.search(r'^\d+', client_id)
|
||||
return match.group()
|
||||
|
||||
def get_gcp_info():
|
||||
if result['project'] in internal_projects:
|
||||
result['internal'] = True
|
||||
return
|
||||
try:
|
||||
results = callGAPI(crm1.projects(), 'getAncestry',
|
||||
throwReasons=[GAPI.PERMISSION_DENIED],
|
||||
projectId=result['project'])
|
||||
for ancestor in results.get('ancestor', []):
|
||||
if ancestor.get('resourceId', {}).get('type') == 'organization' and ancestor.get('resourceId', {}).get('id') == org_id:
|
||||
result['internal'] = True
|
||||
internal_projects.append(result['project'])
|
||||
except GAPI.permissionDenied:
|
||||
# we don't have permission to get project. This might be an external project
|
||||
# or it might be an internal project we don't have rights to get.
|
||||
pass
|
||||
def get_gcp_info(results):
|
||||
for result in results:
|
||||
result['project'] = project_from_client_id(result.get('clientId'))
|
||||
if result['project'] in internal_projects:
|
||||
result['internal'] = True
|
||||
continue
|
||||
result['internal'] = False
|
||||
try:
|
||||
results = callGAPI(crm1.projects(), 'getAncestry',
|
||||
throwReasons=[GAPI.PERMISSION_DENIED],
|
||||
projectId=result['project'])
|
||||
for ancestor in results.get('ancestor', []):
|
||||
if ancestor.get('resourceId', {}).get('type') == 'organization' and ancestor.get('resourceId', {}).get('id') == org_id:
|
||||
result['internal'] = True
|
||||
internal_projects.add(result['project'])
|
||||
except GAPI.permissionDenied:
|
||||
# we don't have permission to get project. This might be an external project
|
||||
# or it might be an internal project we don't have rights to get.
|
||||
pass
|
||||
|
||||
cd = buildGAPIObject(API.DIRECTORY)
|
||||
csvPF = CSVPrintFile() if Act.csvFormat() else None
|
||||
@@ -72493,7 +72496,6 @@ def _printShowTokens(entityType, users):
|
||||
elif myarg == 'gcpdetails':
|
||||
getGCPDetails = True
|
||||
extra_titles = ['project', 'internal']
|
||||
gcp_projects = {}
|
||||
elif not entityType:
|
||||
Cmd.Backup()
|
||||
entityType, users = getEntityToModify(defaultEntityType=Cmd.ENTITY_USERS)
|
||||
@@ -72514,7 +72516,7 @@ def _printShowTokens(entityType, users):
|
||||
else:
|
||||
tokenTitle = TOKENS_TITLE_MAP[aggregateUsersBy]
|
||||
if getGCPDetails:
|
||||
internal_projects = [] # cache
|
||||
internal_projects = set() # cache
|
||||
crm = buildGAPIObject('cloudresourcemanager')
|
||||
crm1 = buildGAPIObject('cloudresourcemanagerv1')
|
||||
admin_email = _getAdminEmail()
|
||||
@@ -72542,9 +72544,7 @@ def _printShowTokens(entityType, users):
|
||||
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED],
|
||||
userKey=user, fields=f'items({fields})')
|
||||
if getGCPDetails:
|
||||
for result in results:
|
||||
result['project'] = project_from_client_id(result.get('clientId'))
|
||||
get_gcp_info()
|
||||
get_gcp_info(results)
|
||||
if not aggregateUsersBy:
|
||||
if not csvPF:
|
||||
jcount = len(results)
|
||||
|
||||
Reference in New Issue
Block a user