Forbid creation of dashboard permissions with both a user and a team (#40104) (#40412)

These permissions could be created through the API but would not show
correctly in the UI.

(cherry picked from commit 5af96544f3)

Co-authored-by: Jesse Weaver <pianohacker@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-10-13 16:10:40 -06:00
committed by GitHub
co-authored by Jesse Weaver
parent fb79d72230
commit 7689b2f5ec
3 changed files with 51 additions and 5 deletions
+6 -5
View File
@@ -24,11 +24,12 @@ func (p PermissionType) String() string {
// Typed errors
var (
ErrDashboardAclInfoMissing = errors.New("user id and team id cannot both be empty for a dashboard permission")
ErrDashboardPermissionDashboardEmpty = errors.New("dashboard id must be greater than zero for a dashboard permission")
ErrFolderAclInfoMissing = errors.New("user id and team id cannot both be empty for a folder permission")
ErrFolderPermissionFolderEmpty = errors.New("folder id must be greater than zero for a folder permission")
ErrPermissionsWithRoleNotAllowed = errors.New("team and user permissions cannot have an associated role")
ErrDashboardAclInfoMissing = errors.New("user id and team id cannot both be empty for a dashboard permission")
ErrDashboardPermissionDashboardEmpty = errors.New("dashboard id must be greater than zero for a dashboard permission")
ErrFolderAclInfoMissing = errors.New("user id and team id cannot both be empty for a folder permission")
ErrFolderPermissionFolderEmpty = errors.New("folder id must be greater than zero for a folder permission")
ErrPermissionsWithRoleNotAllowed = errors.New("permissions cannot have both a user and team")
ErrPermissionsWithUserAndTeamNotAllowed = errors.New("team and user permissions cannot have an associated role")
)
// Dashboard ACL model