diff --git a/pkg/api/api.go b/pkg/api/api.go index f33b08e6477..679c0d1f760 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -26,6 +26,7 @@ func Register(r *macaron.Macaron) { // authed views r.Get("/profile/", reqSignedIn, Index) r.Get("/org/", reqSignedIn, Index) + r.Get("/org/new", reqSignedIn, Index) r.Get("/datasources/", reqSignedIn, Index) r.Get("/datasources/edit/*", reqSignedIn, Index) r.Get("/org/users/", reqSignedIn, Index) diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index 4dd6ba06819..37a28077175 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -99,7 +99,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro "defaultDatasource": defaultDatasource, "datasources": datasources, "appSubUrl": setting.AppSubUrl, - "viewerRoleMode": setting.ViewerRoleMode, + "allowOrgCreate": setting.AllowUserOrgCreate || c.IsGrafanaAdmin, "buildInfo": map[string]interface{}{ "version": setting.BuildVersion, "commit": setting.BuildCommit, diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index b53cfac472a..b015062fa9b 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -79,7 +79,6 @@ var ( AllowUserOrgCreate bool AutoAssignOrg bool AutoAssignOrgRole string - ViewerRoleMode string // Http auth AdminUser string @@ -386,7 +385,6 @@ func NewConfigContext(args *CommandLineArgs) { AllowUserOrgCreate = users.Key("allow_org_create").MustBool(true) AutoAssignOrg = users.Key("auto_assign_org").MustBool(true) AutoAssignOrgRole = users.Key("auto_assign_org_role").In("Editor", []string{"Editor", "Admin", "Viewer"}) - ViewerRoleMode = users.Key("viewer_role_mode").In("default", []string{"default", "strinct"}) // anonymous access AnonymousEnabled = Cfg.Section("auth.anonymous").Key("enabled").MustBool(false) diff --git a/public/app/controllers/sidemenuCtrl.js b/public/app/controllers/sidemenuCtrl.js index cefddec2ab5..b7ba32f0d35 100644 --- a/public/app/controllers/sidemenuCtrl.js +++ b/public/app/controllers/sidemenuCtrl.js @@ -68,11 +68,13 @@ function (angular, _, $, config) { }); }); - $scope.orgMenu.push({ - text: "New Organization", - icon: "fa fa-fw fa-plus", - href: $scope.getUrl('/org/new') - }); + if (config.allowOrgCreate) { + $scope.orgMenu.push({ + text: "New Organization", + icon: "fa fa-fw fa-plus", + href: $scope.getUrl('/org/new') + }); + } }); };