Skip to content
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

Log whenever a user logs in to a client #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mitchelljkotler
Copy link
Member

Log every time someone uses Squarelet to log in to a client site (MuckRock, DocumentCloud, Big Local, etc)

"""Log which client users login to"""
# take an arbitrary non-individual organization, since most users will have one org
organization = user.organizations.filter(individual=False).first()
plan = None if organization is None else organization.plan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth trying to figure out if a user belongs to any org with a premium plan here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly? I didn't devote too much time thinking about it as I assume the vast majority of users are only in one org. Depending on how accurate we need to be, it might be worth doing something smarter

@@ -217,3 +217,38 @@ def is_hub_eligible(self):
| Q(groups__hub_eligible=True)
| Q(parent__hub_eligible=True)
).exists()


class LoginLog(models.Model):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a plan to truncate this table at some point when we have two billion logins?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally we would have somewhere we can put this data where we can easily analyze it. Is that just here and we build some visualizations on top? Possibly try putting it in datasette? Or use a third party tool that would let us analyze it? I am also not sure if we want to just truncate after a certain amount of time or if we want to archive old data for historical purposes

@allanlasser
Copy link
Member

How can team members get data out for analysis?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants