Skip to content

Commit

Permalink
Merge b47cd57 into 8b66cd4
Browse files Browse the repository at this point in the history
  • Loading branch information
Avantol13 committed Oct 14, 2019
2 parents 8b66cd4 + b47cd57 commit a8ace42
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions fence/sync/sync_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,29 @@ def _update_authz_in_arborist(self, session, user_projects, user_yaml=None):
# update the project info with `projects` specified in user.yaml
self.sync_two_phsids_dict(user_yaml.user_abac, user_projects)

# get list of users from arborist to make sure users that are completely removed
# from authorization sources get policies revoked
arborist_users = {}
try:
arborist_users = self.arborist_client.get(
url=self.arborist_client._user_url
).json
except ArboristError as error:
self.logger.warning(
"Could not get list of users in Arborist, continuing anyway. "
"WARNING: this sync will NOT remove access for users no longer in "
f"authorization sources. Arborist error: {error}"
)
# TODO usersync should exit with non-zero exit code at the end, but sync
# itself should continue

arborist_user_projects = {
user.get("name", "unknown"): {} for user in arborist_users.items()
}

# update the project info with users from arborist
self.sync_two_phsids_dict(arborist_user_projects, user_projects)

for username, user_project_info in user_projects.items():
self.logger.info("processing user `{}`".format(username))
user = query_for_user(session=session, username=username)
Expand Down

0 comments on commit a8ace42

Please sign in to comment.