Skip to content

Commit

Permalink
Fixed logic flaw in gam print|show policies where non-matching poli…
Browse files Browse the repository at this point in the history
…cies were displayed.
  • Loading branch information
taers232c committed Nov 11, 2024
1 parent ff152f1 commit 079769d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: taers232c.GAMADV-XTD3
release-tag: v7.00.37
release-tag: v7.00.38
max-versions-to-keep: 1 # keep only latest versions
installers-regex: '\.msi$'
token: ${{ secrets.WINGET_TOKEN }}
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ script:

before_deploy:
# Comment out for Linux Xenial and Trusty
#- yes | gem update --system --force
#- gem install bundler
#- gem install uri
#- gem install logger
- yes | gem update --system --force
- gem install bundler
- gem install uri
- gem install logger
- export TRAVIS_TAG="preview"
- unset LD_LIBRARY_PATH

Expand All @@ -111,10 +111,10 @@ deploy:
skip_cleanup: true
draft: true
# Linux 64-Bit Bionic and Linux ARM64 Focal and Linux ARM64 Bionic and Linux ARM64 Xenial
# edge: true
edge: true
# Linux Xenial and Trusty
edge:
branch: v2.0.3-beta.4
# edge:
# branch: v2.0.3-beta.4
# branch: v2.0.5-beta.1
on:
repo: taers232c/GAMADV-XTD3
Expand Down
4 changes: 4 additions & 0 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
7.00.38

Fixed logic flaw in `gam print|show policies` where non-matching policies were displayed.

7.00.37

Added options `group <RegularExpression>` and `ou|org|orgunit <RegularExpression>`
Expand Down
12 changes: 8 additions & 4 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""

__author__ = 'Ross Scroggs <[email protected]>'
__version__ = '7.00.37'
__version__ = '7.00.38'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'

#pylint: disable=wrong-import-position
Expand Down Expand Up @@ -35047,13 +35047,17 @@ def _cleanPolicy(policy, add_warnings, no_appnames,
policy['warning'] = CIPOLICY_ADDITIONAL_WARNINGS[policy['setting']['type']]
if groupId := policy['policyQuery'].get('group'):
_, _, policy['policyQuery']['groupEmail'] = convertGroupCloudIDToEmail(groups_ci, groupId)
if groupEmailPattern is not None and not groupEmailPattern.match(policy['policyQuery']['groupEmail']):
return False
# all groups are in the root OU so the orgUnit attribute is useless
policy['policyQuery'].pop('orgUnit', None)
if groupEmailPattern is not None:
return groupEmailPattern.match(policy['policyQuery']['groupEmail'])
if orgUnitPathPattern is not None:
return False
elif orgId := policy['policyQuery'].get('orgUnit'):
policy['policyQuery']['orgUnitPath'] = convertOrgUnitIDtoPath(cd, orgId)
if orgUnitPathPattern is not None and not orgUnitPathPattern.match(policy['policyQuery']['orgUnitPath']):
if orgUnitPathPattern is not None:
return orgUnitPathPattern.match(policy['policyQuery']['orgUnitPath'])
if groupEmailPattern is not None:
return False
return True

Expand Down

0 comments on commit 079769d

Please sign in to comment.