Add new broadcast related permissions

We want to have new permissions which will be used specifically for
broadcasts:
- `create_broadcasts`
- `approve_broadcasts`
- `reject_broadcasts`
- `cancel_broadcasts`

Cancel and reject will always go together, but having separate database
permissions makes things easier to change in the future.

The permission column of the permissions table is an enum. We can add values
in the alembic upgrade script, but removing individual values from an
enum is not supported by Postgres. To remove values, we have to recreate
the enum with the old values.
This commit is contained in:
Katie Smith
2021-06-16 10:43:19 +01:00
parent 273d14fbe4
commit e5fdd8ee1f
2 changed files with 60 additions and 1 deletions

View File

@@ -1870,6 +1870,10 @@ SEND_LETTERS = 'send_letters'
MANAGE_API_KEYS = 'manage_api_keys'
PLATFORM_ADMIN = 'platform_admin'
VIEW_ACTIVITY = 'view_activity'
CREATE_BROADCASTS = 'create_broadcasts'
APPROVE_BROADCASTS = 'approve_broadcasts'
CANCEL_BROADCASTS = 'cancel_broadcasts'
REJECT_BROADCASTS = 'reject_broadcasts'
# List of permissions
PERMISSION_LIST = [
@@ -1881,7 +1885,12 @@ PERMISSION_LIST = [
SEND_LETTERS,
MANAGE_API_KEYS,
PLATFORM_ADMIN,
VIEW_ACTIVITY]
VIEW_ACTIVITY,
CREATE_BROADCASTS,
APPROVE_BROADCASTS,
CANCEL_BROADCASTS,
REJECT_BROADCASTS,
]
class Permission(db.Model):