mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Profile: Fixes profile preferences being accessible when anonymous access was enabled (#31516)
* Profile: Fixes profile preferences page being available when anonymous access was enabled * Minor change * Renamed property
This commit is contained in:
@@ -19,6 +19,7 @@ var plog = log.New("api")
|
||||
// registerRoutes registers all API HTTP routes.
|
||||
func (hs *HTTPServer) registerRoutes() {
|
||||
reqSignedIn := middleware.ReqSignedIn
|
||||
reqSignedInNoAnonymous := middleware.ReqSignedInNoAnonymous
|
||||
reqGrafanaAdmin := middleware.ReqGrafanaAdmin
|
||||
reqEditorRole := middleware.ReqEditorRole
|
||||
reqOrgAdmin := middleware.ReqOrgAdmin
|
||||
@@ -41,10 +42,10 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
|
||||
// authed views
|
||||
r.Get("/", reqSignedIn, hs.Index)
|
||||
r.Get("/profile/", reqSignedIn, hs.Index)
|
||||
r.Get("/profile/password", reqSignedIn, hs.Index)
|
||||
r.Get("/profile/", reqSignedInNoAnonymous, hs.Index)
|
||||
r.Get("/profile/password", reqSignedInNoAnonymous, hs.Index)
|
||||
r.Get("/.well-known/change-password", redirectToChangePassword)
|
||||
r.Get("/profile/switch-org/:id", reqSignedIn, hs.ChangeActiveOrgAndRedirectToHome)
|
||||
r.Get("/profile/switch-org/:id", reqSignedInNoAnonymous, hs.ChangeActiveOrgAndRedirectToHome)
|
||||
r.Get("/org/", reqOrgAdmin, hs.Index)
|
||||
r.Get("/org/new", reqGrafanaAdmin, hs.Index)
|
||||
r.Get("/datasources/", reqOrgAdmin, hs.Index)
|
||||
@@ -147,7 +148,7 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
|
||||
userRoute.Get("/auth-tokens", routing.Wrap(hs.GetUserAuthTokens))
|
||||
userRoute.Post("/revoke-auth-token", bind(models.RevokeAuthTokenCmd{}), routing.Wrap(hs.RevokeUserAuthToken))
|
||||
})
|
||||
}, reqSignedInNoAnonymous)
|
||||
|
||||
// users (admin permission required)
|
||||
apiRoute.Group("/users", func(usersRoute routing.RouteRegister) {
|
||||
|
||||
Reference in New Issue
Block a user