mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 05:08:36 +08:00
Chore: Remove x from health, alert notification, dashboard, stats, user (#45265)
* Chore: Remove x from health * Chore: Remove x from dashboard and user * Chore: Remove x from alert notification * Chore: Remove x from stats * Fix: Update func signature in stats test * Refactor: Remove x from GetDashboardTags * Chore: Remove x from dashboard * Chore: Remove x from Stats * Fix: Update refs of HasAdminPermissionInFolders * Fix: Adjust funcs in tests to be sqlStore methods * Fix: Fix database folder test sqlstore methods
This commit is contained in:
@ -191,28 +191,30 @@ func shouldForceLogin(c *models.ReqContext) bool {
|
||||
return forceLogin
|
||||
}
|
||||
|
||||
func OrgAdminFolderAdminOrTeamAdmin(c *models.ReqContext) {
|
||||
if c.OrgRole == models.ROLE_ADMIN {
|
||||
return
|
||||
}
|
||||
func OrgAdminFolderAdminOrTeamAdmin(ss sqlstore.Store) func(c *models.ReqContext) {
|
||||
return func(c *models.ReqContext) {
|
||||
if c.OrgRole == models.ROLE_ADMIN {
|
||||
return
|
||||
}
|
||||
|
||||
hasAdminPermissionInFoldersQuery := models.HasAdminPermissionInFoldersQuery{SignedInUser: c.SignedInUser}
|
||||
if err := sqlstore.HasAdminPermissionInFolders(c.Req.Context(), &hasAdminPermissionInFoldersQuery); err != nil {
|
||||
c.JsonApiErr(500, "Failed to check if user is a folder admin", err)
|
||||
}
|
||||
hasAdminPermissionInFoldersQuery := models.HasAdminPermissionInFoldersQuery{SignedInUser: c.SignedInUser}
|
||||
if err := ss.HasAdminPermissionInFolders(c.Req.Context(), &hasAdminPermissionInFoldersQuery); err != nil {
|
||||
c.JsonApiErr(500, "Failed to check if user is a folder admin", err)
|
||||
}
|
||||
|
||||
if hasAdminPermissionInFoldersQuery.Result {
|
||||
return
|
||||
}
|
||||
if hasAdminPermissionInFoldersQuery.Result {
|
||||
return
|
||||
}
|
||||
|
||||
isAdminOfTeamsQuery := models.IsAdminOfTeamsQuery{SignedInUser: c.SignedInUser}
|
||||
if err := sqlstore.IsAdminOfTeams(c.Req.Context(), &isAdminOfTeamsQuery); err != nil {
|
||||
c.JsonApiErr(500, "Failed to check if user is a team admin", err)
|
||||
}
|
||||
isAdminOfTeamsQuery := models.IsAdminOfTeamsQuery{SignedInUser: c.SignedInUser}
|
||||
if err := sqlstore.IsAdminOfTeams(c.Req.Context(), &isAdminOfTeamsQuery); err != nil {
|
||||
c.JsonApiErr(500, "Failed to check if user is a team admin", err)
|
||||
}
|
||||
|
||||
if isAdminOfTeamsQuery.Result {
|
||||
return
|
||||
}
|
||||
if isAdminOfTeamsQuery.Result {
|
||||
return
|
||||
}
|
||||
|
||||
accessForbidden(c)
|
||||
accessForbidden(c)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user