Merge pull request #1985 from cisagov/es/1890-usergroup-migration-docs

1890: Add documentation for making migrations in user_group
This commit is contained in:
Erin Song 2024-04-09 10:55:04 -07:00 committed by GitHub
commit 7e630761cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -19,6 +19,18 @@ role or set of permissions that they have. We use a `UserDomainRole`
`User.domains` many-to-many relationship that works through the `User.domains` many-to-many relationship that works through the
`UserDomainRole` link table. `UserDomainRole` link table.
## Migrating changes to Analyst Permissions model
Analysts are allowed a certain set of read/write registrar permissions.
Setting user permissions requires a migration to change the UserGroup
and Permission models, which requires us to manually make a migration
file for user permission changes.
To update analyst permissions do the following:
1. Make desired changes to analyst group permissions in user_group.py.
2. Follow the steps in the migration file0037_create_groups_v01.py to
create a duplicate migration for the updated user group permissions.
3. To migrate locally, run docker-compose up. To migrate on a sandbox,
push the new migration onto your sandbox before migrating.
## Permission decorator ## Permission decorator
The Django objects that need to be permission controlled are various views. The Django objects that need to be permission controlled are various views.

View file

@ -5,6 +5,11 @@ logger = logging.getLogger(__name__)
class UserGroup(Group): class UserGroup(Group):
"""
UserGroup sets read and write permissions for superusers (who have full access)
and analysts. For more details, see the dev docs for user-permissions.
"""
class Meta: class Meta:
verbose_name = "User group" verbose_name = "User group"
verbose_name_plural = "User groups" verbose_name_plural = "User groups"