fix(create org): Anonymous user can no longer create org, Fixes #2227
This commit is contained in:
@@ -99,7 +99,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
|
||||
"defaultDatasource": defaultDatasource,
|
||||
"datasources": datasources,
|
||||
"appSubUrl": setting.AppSubUrl,
|
||||
"allowOrgCreate": setting.AllowUserOrgCreate || c.IsGrafanaAdmin,
|
||||
"allowOrgCreate": (setting.AllowUserOrgCreate && c.IsSignedIn) || c.IsGrafanaAdmin,
|
||||
"buildInfo": map[string]interface{}{
|
||||
"version": setting.BuildVersion,
|
||||
"commit": setting.BuildCommit,
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ func getOrgHelper(orgId int64) Response {
|
||||
|
||||
// POST /api/orgs
|
||||
func CreateOrg(c *middleware.Context, cmd m.CreateOrgCommand) Response {
|
||||
if !setting.AllowUserOrgCreate && !c.IsGrafanaAdmin {
|
||||
if !c.IsSignedIn || (!setting.AllowUserOrgCreate && !c.IsGrafanaAdmin) {
|
||||
return ApiError(401, "Access denied", nil)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user