mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Merge branch 'main' of https://github.com/GAM-team/GAM
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -126,7 +126,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
cache.tar.xz
|
cache.tar.xz
|
||||||
key: gam-${{ matrix.jid }}-20250805
|
key: gam-${{ matrix.jid }}-20250814
|
||||||
|
|
||||||
- name: Untar Cache archive
|
- name: Untar Cache archive
|
||||||
if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit == 'true'
|
if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit == 'true'
|
||||||
|
|||||||
@@ -44901,21 +44901,39 @@ def waitForMailbox(entityList):
|
|||||||
Ind.Decrement()
|
Ind.Decrement()
|
||||||
|
|
||||||
def getUserLicenses(lic, user, skus):
|
def getUserLicenses(lic, user, skus):
|
||||||
def _callbackGetLicense(_, response, exception):
|
def _callbackGetLicense(request_id, response, exception):
|
||||||
if exception is None:
|
if exception is None:
|
||||||
if response and 'skuId' in response:
|
if response and 'skuId' in response:
|
||||||
licenses.append(response['skuId'])
|
licenses.append(response['skuId'])
|
||||||
|
del(sku_calls[request_id])
|
||||||
|
else:
|
||||||
|
if exception.reason == not_found:
|
||||||
|
del(sku_calls[request_id])
|
||||||
|
|
||||||
|
not_found = 'User does not have a license for specified sku and product'
|
||||||
licenses = []
|
licenses = []
|
||||||
svcargs = dict([('userId', user['primaryEmail']), ('productId', None), ('skuId', None), ('fields', 'skuId')]+GM.Globals[GM.EXTRA_ARGS_LIST])
|
svcargs = dict([('userId', user['primaryEmail']), ('productId', None), ('skuId', None), ('fields', 'skuId')]+GM.Globals[GM.EXTRA_ARGS_LIST])
|
||||||
method = getattr(lic.licenseAssignments(), 'get')
|
method = getattr(lic.licenseAssignments(), 'get')
|
||||||
dbatch = lic.new_batch_http_request(callback=_callbackGetLicense)
|
dbatch = lic.new_batch_http_request(callback=_callbackGetLicense)
|
||||||
|
sku_calls = {}
|
||||||
for sku in skus:
|
for sku in skus:
|
||||||
svcparms = svcargs.copy()
|
svcparms = svcargs.copy()
|
||||||
svcparms['productId'] = sku[0]
|
svcparms['productId'] = sku[0]
|
||||||
svcparms['skuId'] = sku[1]
|
sku_id = sku[1]
|
||||||
dbatch.add(method(**svcparms))
|
svcparms['skuId'] = sku_id
|
||||||
dbatch.execute()
|
sku_calls[sku_id] = method(**svcparms)
|
||||||
|
try_count = 0
|
||||||
|
while sku_calls:
|
||||||
|
try_count += 1
|
||||||
|
dbatch = lic.new_batch_http_request(callback=_callbackGetLicense)
|
||||||
|
for sku_id, sku_call in sku_calls.items():
|
||||||
|
dbatch.add(sku_call, request_id=sku_id)
|
||||||
|
dbatch.execute()
|
||||||
|
if sku_calls:
|
||||||
|
if try_count >= 5:
|
||||||
|
# give up and return what we have
|
||||||
|
return licenses
|
||||||
|
time.sleep(5)
|
||||||
return licenses
|
return licenses
|
||||||
|
|
||||||
USER_NAME_PROPERTY_PRINT_ORDER = [
|
USER_NAME_PROPERTY_PRINT_ORDER = [
|
||||||
|
|||||||
Reference in New Issue
Block a user