Skip to content

Commit

Permalink
Include uaa username in bot user report
Browse files Browse the repository at this point in the history
  • Loading branch information
rahearn committed Nov 18, 2024
1 parent 2972f3d commit a2f0bcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions auditree/templates/reports/cf/user-roles.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ The following users have access to our cloud.gov infrastructure.

{% for section_heading, user_guids in all_successes.items() -%}
## {{ section_heading }}
{% for guid in user_guids: %}
| User Name | Roles |
| --------- | ----- |
{% for guid in user_guids: -%}
{% set user = test.users[guid] -%}
* **User**: {{ user["user_name"] }}<br />
**Roles**: {{ user["roles"] | join(', ') }}
| {{ user["user_name"] }} | {{ user["roles"] | join('<br/>') | safe }} |
{% endfor %}
{% endfor %}
3 changes: 2 additions & 1 deletion auditree/utils/cf_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ def __init__(self, entity):
@property
def username(self):
if self._is_service_account:
return client.v3.service_credential_bindings.get(
service_name = client.v3.service_credential_bindings.get(
self._username, include="service_instance"
).service_instance()["name"]
return f"{service_name} ({self._username})"
else:
return self._username

Expand Down

0 comments on commit a2f0bcb

Please sign in to comment.