listmonk/models/permissions.go
Kailash Nadh a271bf54d5 Introduce per-campaign filter permissions. Closes #2325.
This patch introduces new `campaigns:get_all` and `campaigns:manage_all`
permissions which alter the behaviour of the the old `campaigns:get` and
`campaigns:manage` permissions. This is a subtle breaking behavioural change.

Old:

- `campaigns:get` -> View all campaigns irrespective of a user's list
  permissions.
- `campaigns:manage` -> Manage all campaigns irrespective of a user's list
  permissions.

New:

- `campaigns:get_all` -> View all campaigns irrespective of a user's list
  permissions.
- `campaigns:manage_all` -> Manage all campaigns irrespective of a user's list
  permissions.
- `campaigns:get` -> View only the campaigns that have at least one list to
  which which a user has get or manage access.
- `campaigns:manage` -> Manage only the campaigns that have at list one list
  to which a user has get or manage access.

In addition, this patch refactors and cleans up certain permission related
logic and functions.
2025-03-31 16:39:42 +05:30

33 lines
1.3 KiB
Go

package models
const (
PermListGetAll = "lists:get_all"
PermListManageAll = "lists:manage_all"
PermListManage = "list:manage"
PermListGet = "list:get"
PermSubscribersGet = "subscribers:get"
PermSubscribersGetAll = "subscribers:get_all"
PermSubscribersManage = "subscribers:manage"
PermSubscribersImport = "subscribers:import"
PermSubscribersSqlQuery = "subscribers:sql_query"
PermTxSend = "tx:send"
PermCampaignsGet = "campaigns:get"
PermCampaignsGetAll = "campaigns:get_all"
PermCampaignsGetAnalytics = "campaigns:get_analytics"
PermCampaignsManage = "campaigns:manage"
PermCampaignsManageAll = "campaigns:manage_all"
PermBouncesGet = "bounces:get"
PermBouncesManage = "bounces:manage"
PermWebhooksPostBounce = "webhooks:post_bounce"
PermMediaGet = "media:get"
PermMediaManage = "media:manage"
PermTemplatesGet = "templates:get"
PermTemplatesManage = "templates:manage"
PermUsersGet = "users:get"
PermUsersManage = "users:manage"
PermRolesGet = "roles:get"
PermRolesManage = "roles:manage"
PermSettingsGet = "settings:get"
PermSettingsManage = "settings:manage"
PermSettingsMaintain = "settings:maintain"
)