-
-
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
Conversation
99dbdf3
to
80963c9
Compare
0233b15
to
9ad62c0
Compare
@@ -21,4 +21,18 @@ class UserSecurityLogFilter(FilterSet): | |||
|
|||
class Meta: | |||
model = AuditLog | |||
fields = ['ip', 'project', 'action'] | |||
fields = [] |
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
9ad62c0
to
5bd1f63
Compare
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 looks like a good start, but I think we definitely want the ability to filter by dates by the user. It doesn't need to be in the UI yet, but at least GET args.
readthedocs/organizations/templates/organizations/security_log.html
Outdated
Show resolved
Hide resolved
{% 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be passing in something like plan=Pro
in order to clarify what plan is required?
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, not a huge priority though. 👍
readthedocs/organizations/templates/organizations/security_log.html
Outdated
Show resolved
Hide resolved
('IP', 'ip'), | ||
('Browser', 'browser'), | ||
] | ||
data = self._get_queryset().values_list(*[value for _, value in values]) |
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 could potentially be huge for a user with pageviews. We are likely going to need something async that emails this to users, or uploads it to storage, or something. We can worry about that later though.
@ericholscher I have added some docs and filtering by dates (
|
Awesome! I looked over it, and it seems good to me.
I think it's fine for now that we don't document them. I do think we should probably make them work with a GET arg though.
I think so. I think otherwise some users won't be able to download anything because the view will time out, and it will be confusing to filter the data and not have the download respect that.
Yea -- I think updating the export/download link is probably the easiest way to handle this. |
User security log | ||
----------------- | ||
|
||
We store user security logs from the last 90 days, and track the following events: |
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.
Does this vary by plan on .com? If so, we should probably put this in a small table comparing each site. I dislike having the tabs where you have to click to see the Commercial one, so a small table seems best?
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.
User securtiy logs are 90 days for both, we could respect the max period set by the organizations they belong on .com, but I have some questions if that happens, should we show those type of logs to org owners as well? #8620 (comment)
days_ago = timezone.now() - timezone.timedelta(days=retention_limit) | ||
return creation_date | ||
start_date = timezone.now().date() - timezone.timedelta(days=retention_limit) | ||
# The max we can go back is to the creation of the organization. |
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.
👍
@@ -189,9 +187,17 @@ def get(self, request, *args, **kwargs): | |||
return self._get_csv_data() | |||
return super().get(request, *args, **kwargs) | |||
|
|||
def _get_start_date(self): |
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.
Seems like we want to get the request.GET.start_date here?
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.
That's already handled by the filter, the filter acts on top of this query.
Co-authored-by: Eric Holscher <[email protected]>
Download button now uses the current filters. But had to use a link instead of a form, as the form removes all query args from the forms' |
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.
Changes look good 👍
Let's get this shipped and deployed.
Similar to the user security logs, but from all the organization and according to their plan.
I was able to re-use the listing from the user security log :D.
Didn't want to overload the UI with all the information from each record (but you can get everything with the download button), still you can see some information when hovering over some places.