BirkbeckCTP / janeway

A web-based platform for publishing journals, preprints, conference proceedings, and books
https://janeway.systems/
GNU Affero General Public License v3.0
167 stars 65 forks source link

User account needs flag to prevent login/activity (user ban) #4053

Open alainna opened 4 months ago

alainna commented 4 months ago

Is your feature request related to a problem? Please describe. As a Janeway administrator, I need a convenient method to prevent a user from logging in or making new submissions to a Janeway journal or repository.

Describe the solution you'd like Add new toggle option to user profile, visible in Django admin and user table: Is banned

When ticked true:

When user tries to log in, they should receive a relevant message, e.g. Unable to log in. Please contact administrator.

Mockup

image

dev notes We also want to rename "Is Active" to "Email Validated", which is what that field is being used for. Since we want to record the reason for a ban, consider not using a bool flag, but rather a m2m to a new model that stores:

We can then implement an is_banned() method like:

def is_banned(self, site):
   return any(self.banreason_set.filter(enforced=True, site=site))
mauromsl commented 2 weeks ago

Thanks @alainna

We have triaged this issue and added some development notes, open to comments if you want to expand on them.