-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Organizations: show audit logs #8588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5bd1f63
31d2e66
5c4a3a9
56b8129
f06ad81
2a63958
f97970c
6075b57
10ddab7
7ab1acc
60ffb95
47b7cb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{% load i18n %} | ||
|
||
{% comment %} | ||
If `omit_user` is given, the username attached to the log isn't shown. | ||
This is useful when listing logs for the same user. | ||
{% endcomment %} | ||
|
||
<div class="module-list"> | ||
<div class="module-list-wrapper"> | ||
<ul> | ||
{% for log in object_list %} | ||
<li class="module-item"> | ||
{% if log.action == AuditLog.AUTHN %} | ||
{% if omit_user %} | ||
{% blocktrans trimmed with action=log.action method=log.auth_backend_display %} | ||
<a href="?action={{ action }}" title="{{ method }}">Authenticated</a> | ||
{% endblocktrans %} | ||
{% elif log.log_user_id %} | ||
{% blocktrans trimmed with action=log.action user=log.log_user_username method=log.auth_backend_display %} | ||
<a href="?user={{ user }}"> | ||
<code>{{ user }}</code> | ||
</a> | ||
<a href="?action={{ action }}" title="{{ method }}">authenticated</a> | ||
{% endblocktrans %} | ||
{% else %} | ||
{% blocktrans trimmed with action=log.action method=log.auth_backend_display %} | ||
User <a href="?action={{ action }}" title="{{ method }}">authenticated</a> | ||
{% endblocktrans %} | ||
{% endif %} | ||
{% elif log.action == AuditLog.AUTHN_FAILURE %} | ||
{% blocktrans trimmed with action=log.action method=log.auth_backend_display %} | ||
<a href="?action={{ action }}" title="{{ method }}">Authentication attempt</a> | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{% endblocktrans %} | ||
{% elif log.action == AuditLog.PAGEVIEW %} | ||
{% if log.log_user_id %} | ||
{% blocktrans trimmed with action=log.action user=log.log_user_username path=log.resource %} | ||
<a href="?user={{ user }}"> | ||
<code>{{ user }}</code> | ||
</a> | ||
<a href="?action={{ action }}" title="{{ path }}">visited</a> a page | ||
{% endblocktrans %} | ||
{% else %} | ||
{% blocktrans trimmed with action=log.action user=log.log_user_username path=log.resource %} | ||
A user <a href="?action={{ action }}" title="{{ path }}">visited</a> a page | ||
{% endblocktrans %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% trans "from" %} | ||
|
||
<a href="?ip={{ log.ip }}" title="{{ log.browser }}"> | ||
<code>{{ log.ip }}</code> | ||
</a> | ||
|
||
{# If the authentication was on a doc domain. #} | ||
{% if log.log_project_id %} | ||
{% trans "on" %} | ||
{% if log.project %} | ||
<a href="{% url 'projects_detail' log.log_project_slug %}"> | ||
<code>{{ log.log_project_slug }}</code> | ||
</a> | ||
{% else %} | ||
{# The original project has been deleted, don't link to it. #} | ||
<code title="{{ log.resource }}">{{ log.log_project_slug }}</code> | ||
{% endif %} | ||
{% endif %} | ||
|
||
<span class="quiet right" title="{{ log.created|date:"DATETIME_FORMAT" }}"> | ||
{% blocktrans trimmed with log.created|timesince as date %} | ||
{{ date }} ago | ||
{% endblocktrans %} | ||
</span> | ||
</li> | ||
{% empty %} | ||
<li class="module-item"> | ||
<p class="quiet"> | ||
{% trans 'No activity logged yet' %} | ||
</p> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends "organizations/admin/base.html" %} | ||
|
||
{% load i18n %} | ||
{% load pagination_tags %} | ||
|
||
{% block title %}{% trans "Security Log" %}{% endblock %} | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{% block organization-admin-security-log %}active{% endblock %} | ||
|
||
{% block edit_content_header %} {% trans "Security Log" %} {% endblock %} | ||
|
||
{% block edit_content %} | ||
|
||
{% if not enabled %} | ||
{% include 'projects/includes/feature_disabled.html' with organization=organization %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be passing in something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could pass the feature type and check from the other template what plan is required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, not a huge priority though. 👍 |
||
{% elif days_limit and days_limit > 0 %} | ||
<p> | ||
{% blocktrans trimmed with days_limit as days_limit %} | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Showing logs from the last {{ days_limit }} days. | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{% endblocktrans %} | ||
</p> | ||
{% else %} | ||
<p>{% trans "Showing logs from all time." %}</p> | ||
{% endif %} | ||
</p> | ||
|
||
{% autopaginate object_list 15 %} | ||
|
||
<div class="module"> | ||
<form method="get"> | ||
<button type="submit" name="download" value="true">{% trans "Download all data" %}</button> | ||
</form> | ||
|
||
{% include "audit/list_logs.html" with omit_user=False %} | ||
</div> | ||
{% paginate %} | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wasn't needed, as these values are defined as attributes, but you still need to declare
fields