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

allow userdraft save #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion authapi/api/management/commands/upsert_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def handle(self, *args, **options):

db_user.userdata.save()

# make sure the user has permission to login as an admin
# make sure the user has permission to login as an admin and edit
# its own profile
insert_or_update(
ACL,
dict(
Expand All @@ -115,6 +116,16 @@ def handle(self, *args, **options):
object_id=1
)
)
if db_user.is_staff or db_user.is_admin:
insert_or_update(
ACL,
dict(
user=db_user.userdata,
perm='edit',
object_type='UserData',
object_id=db_user.userdata.id
)
)

for el in udata['election_permissions']:
# if permission list is empty, it means we have to ensure
Expand Down