Skip to content

Commit

Permalink
Allow custom al_manage_users privilege to access the manage users page,
Browse files Browse the repository at this point in the history
fix #128
  • Loading branch information
nonprofittechy committed May 17, 2024
1 parent 747aadc commit 78b5541
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docassemble/ALDashboard/data/questions/manage_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
sessions are unique: True
required privileges:
- admin
- al_manage_users
temporary session: True
---
modules:
Expand All @@ -33,6 +34,24 @@ code: |
id: select user
question: |
Manage users
subquestion: |
% if not user_has_privilege(["admin"]):
**Note**: make sure the role `al_manage_users` any of the the following desired [permissions](https://docassemble.org/docs/config.html#permissions)
in the global configuration:
```
permissions:
al_manage_users:
- access_user_info
- edit_user_active_status
- edit_user_password
- delete_user
- edit_sessions
- access_sessions
- access_privileges
- edit_user_privileges
```
% endif
fields:
- User: chosen_user
datatype: integer
Expand Down Expand Up @@ -95,7 +114,7 @@ event: do_download_playground
---
code: |
def valid_password(pword):
if not re.match(r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,}$", pword):
if not re.match(r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d!@#$%^&*()_+\-=\[\]{};:\'\"\\|,.<>\/?]{6,}$", pword):
validation_error(word("Password must have at least 6 characters with one lowercase letter, one uppercase letter and one number"))
return True
---
Expand Down
1 change: 1 addition & 0 deletions docassemble/ALDashboard/data/questions/menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ data:
image: users-cog
privilege:
- admin
- al_manage_users
- name: Usage stats
url: ${ interview_url(i="docassemble.InterviewStats:data/questions/stats.yml", reset=1) }
image: chart-bar
Expand Down

0 comments on commit 78b5541

Please sign in to comment.