Forbid creation of dashboard permissions with both a user and a team (#40104)
These permissions could be created through the API but would not show correctly in the UI.
This commit is contained in:
@@ -112,6 +112,10 @@ func (hs *HTTPServer) UpdateDashboardPermissions(c *models.ReqContext, apiCmd dt
|
||||
|
||||
func validatePermissionsUpdate(apiCmd dtos.UpdateDashboardAclCommand) error {
|
||||
for _, item := range apiCmd.Items {
|
||||
if item.UserID > 0 && item.TeamID > 0 {
|
||||
return models.ErrPermissionsWithUserAndTeamNotAllowed
|
||||
}
|
||||
|
||||
if (item.UserID > 0 || item.TeamID > 0) && item.Role != nil {
|
||||
return models.ErrPermissionsWithRoleNotAllowed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user