Skip to content

Add roles and departments#582

Open
GDay wants to merge 22 commits into
add-permissions-based-on-departmentfrom
add-departments-with-people
Open

Add roles and departments#582
GDay wants to merge 22 commits into
add-permissions-based-on-departmentfrom
add-departments-with-people

Conversation

@GDay

@GDay GDay commented Oct 14, 2025

Copy link
Copy Markdown
Member

This will allow admins/managers to add users to their own departments in specific roles.

@GDay GDay requested a review from Copilot October 17, 2025 02:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Adds role management within departments, including CRUD views, templates, drag-and-drop assignment of users to roles, and supporting model, selectors, factories, and tests.

  • Introduces Role model and Department–Sequence relationship.
  • Adds views, URLs, templates, and JS for managing departments and roles and assigning users to roles.
  • Provides test coverage for creating/updating departments and roles and assigning users.

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
back/users/selectors.py Adds role selector and distinct filters supporting role assignment logic.
back/users/models.py Introduces Role model and Department.sequences relation enabling role-feature associations.
back/users/migrations/0045_department_sequences_role.py Migration creating Role model and Department.sequences field.
back/users/factories.py Adds RoleFactory for test/data setup.
back/conftest.py Registers RoleFactory for pytest fixtures.
back/admin/people/views.py Removes legacy department views superseded by new department_views module.
back/admin/people/urls.py Routes updated to use new department and role views including add/update endpoints.
back/admin/people/department_views.py New views for listing, creating, updating departments/roles and assigning users.
back/admin/people/templates/departments.html Replaces simple list with drag-and-drop UI and user list.
back/admin/people/templates/_departments_list.html Partial rendering departments, roles, and users per role.
back/admin/people/templates/department_update.html Department update form plus roles display.
back/admin/people/templates/role_create.html Role creation form template.
back/admin/people/templates/role_update.html Role update form template.
back/admin/people/tests/department_tests.py Adds tests for department/role CRUD and user-role assignment.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread back/admin/people/tests/department_tests.py Outdated
Comment thread back/admin/people/templates/departments.html Outdated
Comment thread back/admin/people/templates/departments.html Outdated
Comment thread back/admin/people/department_views.py
Comment thread back/admin/people/templates/departments.html Outdated
@GDay GDay requested a review from Copilot October 17, 2025 02:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 8 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread back/admin/people/department_views.py Outdated
Comment thread back/admin/people/views/departments.py
Comment thread back/admin/people/views/departments.py
Comment thread back/admin/people/views/departments.py Outdated
Comment thread back/admin/people/views/departments.py
Comment thread back/admin/people/templates/_departments_list.html Outdated
Comment thread back/admin/people/templates/_departments_list.html Outdated
Comment thread back/admin/people/templates/departments.html Outdated

@cscheng cscheng left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The general approach for this functionality is fine. I have a bunch of comments and suggestions at the detail/code level, but in my testing it looks like there are a few things missing (that may be are already planned in a future PR?):

  1. How is deletion of departments handled?
  2. How is deletion of roles handled?
  3. What if a manager accidentally drags and drops a user to the incorrect role? This action cannot be undone.

Comment thread back/admin/people/templates/_departments_list.html Outdated
Comment thread back/admin/people/templates/_departments_list.html Outdated
Comment thread back/admin/people/templates/_departments_list.html Outdated
Comment thread back/admin/people/templates/_departments_list.html Outdated
Comment thread back/admin/people/templates/department_update.html Outdated
Comment thread back/admin/people/tests/department_tests.py
Comment thread back/admin/people/tests/department_tests.py Outdated
Comment thread back/admin/people/tests/department_tests.py
Comment thread back/admin/people/tests/department_tests.py
Comment thread back/admin/people/tests/department_tests.py Outdated
GDay and others added 13 commits October 21, 2025 03:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@compgeniuses

Copy link
Copy Markdown

is this PR ready to merge and release, together with #572 ?

@GDay

GDay commented Dec 11, 2025

Copy link
Copy Markdown
Member Author

@compgeniuses not yet. These features are pretty much done, they are sponsored by a company and we are still in talks about the final touches.

@dd-Simon

dd-Simon commented May 5, 2026

Copy link
Copy Markdown

Is this still in the works or has it been shelved? This looks like an interesting feature.

@GDay

GDay commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

@dd-Simon I am planning to merge this in the next few weeks. No exact ETA yet.

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.

5 participants