From 3185a86b224b301dc9c88f14cd4819525d640ecb Mon Sep 17 00:00:00 2001 From: "Langhammer, Jens" Date: Thu, 10 Oct 2019 13:01:36 +0200 Subject: [PATCH] core(minor): add separate permission to reset user's password --- .../core/migrations/0002_auto_20191010_1058.py | 17 +++++++++++++++++ passbook/core/models.py | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 passbook/core/migrations/0002_auto_20191010_1058.py diff --git a/passbook/core/migrations/0002_auto_20191010_1058.py b/passbook/core/migrations/0002_auto_20191010_1058.py new file mode 100644 index 000000000..76cd446ba --- /dev/null +++ b/passbook/core/migrations/0002_auto_20191010_1058.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.6 on 2019-10-10 10:58 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_core', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='user', + options={'permissions': (('reset_user_password', 'Reset Password'),)}, + ), + ] diff --git a/passbook/core/models.py b/passbook/core/models.py index 301e1d878..95da3a3f8 100644 --- a/passbook/core/models.py +++ b/passbook/core/models.py @@ -58,6 +58,12 @@ class User(GuardianUserMixin, AbstractUser): self.password_change_date = now() return super().set_password(password) + class Meta: + + permissions = ( + ('reset_user_password', 'Reset Password'), + ) + class Provider(models.Model): """Application-independent Provider instance. For example SAML2 Remote, OAuth2 Application"""