Access control: Add access control based permissions to admins/users (#32409)

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
Vardan Torosyan
2021-04-14 16:31:27 +02:00
committed by GitHub
co-authored by Emil Tullstedt
parent cdb4785496
commit 9f82eac833
10 changed files with 230 additions and 81 deletions
+31
View File
@@ -38,3 +38,34 @@ func (p RoleDTO) Role() Role {
Description: p.Description,
}
}
const (
// Permission actions
ActionUsersRead = "users:read"
ActionUsersWrite = "users:write"
ActionUsersTeamRead = "users.teams:read"
// We can ignore gosec G101 since this does not contain any credentials
// nolint:gosec
ActionUsersAuthTokenList = "users.authtoken:list"
// We can ignore gosec G101 since this does not contain any credentials
// nolint:gosec
ActionUsersAuthTokenUpdate = "users.authtoken:update"
// We can ignore gosec G101 since this does not contain any credentials
// nolint:gosec
ActionUsersPasswordUpdate = "users.password:update"
ActionUsersDelete = "users:delete"
ActionUsersCreate = "users:create"
ActionUsersEnable = "users:enable"
ActionUsersDisable = "users:disable"
ActionUsersPermissionsUpdate = "users.permissions:update"
ActionUsersLogout = "users:logout"
ActionUsersQuotasList = "users.quotas:list"
ActionUsersQuotasUpdate = "users.quotas:update"
// Global Scopes
ScopeUsersAll = "users:*"
ScopeUsersSelf = "users:self"
)
const RoleGrafanaAdmin = "Grafana Admin"