From b46f8bad6d585006d99c6520e476d4a81ee7849e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 30 Mar 2015 10:12:24 +0200 Subject: [PATCH] Added check for allow_user_org_create, updated admin docs --- conf/defaults.ini | 2 +- docs/mkdocs.yml | 2 +- docs/sources/reference/admin.md | 28 +++++++++++++++++----------- pkg/api/org.go | 7 ++++++- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index d372c825f53..d328733abc9 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -22,7 +22,7 @@ cert_file = cert_key = [analytics] -# Server reporting, sends usage counters to stats.grafana.org (https). +# Server reporting, sends usage counters to stats.grafana.org every 24 hours. # No ip addresses are being tracked, only simple counters to track # running instances, dashboard and error counts. It is very helpful to us. # Change this option to false to disable reporting. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 5d4ddbf8de6..6976e46d060 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -48,7 +48,7 @@ pages: - ['reference/scripting.md', 'Reference', 'Scripted dashboards'] - ['reference/playlist.md', 'Reference', 'Playlist'] - ['reference/export_import.md', 'Reference', 'Import & Export'] -- ['reference/admin.md', 'Reference', 'Grafana Admin'] +- ['reference/admin.md', 'Reference', 'Administration'] - ['reference/http_api.md', 'Reference', 'HTTP API'] - ['datasources/graphite.md', 'Data Sources', 'Graphite'] diff --git a/docs/sources/reference/admin.md b/docs/sources/reference/admin.md index 44491d8fdfc..854147b4240 100644 --- a/docs/sources/reference/admin.md +++ b/docs/sources/reference/admin.md @@ -1,30 +1,36 @@ ---- -page_title: Grafana Admin -page_description: Grafana Admin guide +page_title: Administration +page_description: Grafana Administration page_keywords: grafana, admin, administration, documentation --- +# Administration + Grafana has two levels of administrators: * Organizational administrators: These admins can manage users within specific organizations in a particular Grafana installation * Grafana administrators: These super admins can manage users across all organizations in a Grafana installation. They can also change and access system-wide settings. -# Organizational Administrators +## Organizational Administrators -Note: If Grafana is configured with users.allow_org_create = true, any User of any Organization will be able to start their own Organization and become the administrator of that Organization. +As an Organizational administrator, you can add `Data Sources`, add Users to your Organization and +modify Organization details and options. -As an Organizational administrator, you can manage all Users within your Organization. +> *Note*: If Grafana is configured with `users.allow_org_create = true`, any User of any Organization will be able to +> start their own Organization and become the administrator of that Organization. -# Grafana Administrators -As a Grafana Administrator, you have complete access to any Organization or User in that instance of Grafana. +## Grafana Administrators + +As a Grafana Administrator, you have complete access to any Organization or User in that instance of Grafana. When performing actions as a Grafana admin, the sidebar will change it's apperance as below to indicate you are performing global server administration. -[screenshot] - From the Grafana Server Admin page, you can access the System Info page which summarizes all of the backend configuration settings of the Grafana server. -# Why would I have multiple Organizations? +## Why would I have multiple Organizations? -In many cases, a Grafana installation will only have one Organization. There's no need to create multiple Organizations if you want all your users to have access to the same set of dashboards and data. In a multitenant deployment, Organizations can be used to provide a full Grafana experience to different sets of users from a single Grafana instance, at the convenience of the Grafana Administrator. +In many cases, a Grafana installation will only have one Organization. There's no need to create multiple Organizations +if you want all your users to have access to the same set of dashboards and data. In a multitenant deployment, +Organizations can be used to provide a full Grafana experience to different sets of users from a single Grafana instance, +at the convenience of the Grafana Administrator. diff --git a/pkg/api/org.go b/pkg/api/org.go index ed180b1af77..ac8727c9e49 100644 --- a/pkg/api/org.go +++ b/pkg/api/org.go @@ -5,6 +5,7 @@ import ( "github.com/grafana/grafana/pkg/metrics" "github.com/grafana/grafana/pkg/middleware" m "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/setting" ) func GetOrg(c *middleware.Context) { @@ -29,8 +30,12 @@ func GetOrg(c *middleware.Context) { } func CreateOrg(c *middleware.Context, cmd m.CreateOrgCommand) { - cmd.UserId = c.UserId + if !setting.AllowUserOrgCreate && !c.IsGrafanaAdmin { + c.JsonApiErr(401, "Access denied", nil) + return + } + cmd.UserId = c.UserId if err := bus.Dispatch(&cmd); err != nil { c.JsonApiErr(500, "Failed to create organization", err) return