From e1703166f029c9a6315e0e0beb2cc46259ff9f21 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 12 Dec 2016 19:06:21 +0100 Subject: [PATCH 1/7] docs(changelog): add thank you note to contributor --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a313e91013..49cc8611019 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ * **Elasticsearch**: Added support for Missing option (bucket) for terms aggregation [#4244](https://github.com/grafana/grafana/pull/4244), thx [@shanielh](https://github.com/shanielh) * **Elasticsearch**: Added support for Elasticsearch 5.x [#6356](https://github.com/grafana/grafana/pull/6356), thx [@lpic10](https://github.com/lpic10) * **CLI**: Make it possible to reset the admin password using the grafana-cli. [#5479](https://github.com/grafana/grafana/issues/5479) -* **Influxdb**: Support multiple tags in InfluxDB annotations. [#4550](https://github.com/grafana/grafana/pull/4550) +* **Influxdb**: Support multiple tags in InfluxDB annotations. [#4550](https://github.com/grafana/grafana/pull/4550), thx [@adrianlzt](https://github.com/adrianlzt) ### Bugfixes * **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679) From 0841e841f53cbdebc2073caad3afbb44e4890eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 12 Dec 2016 22:12:27 +0100 Subject: [PATCH 2/7] cleanup(): removed docker/production folder as it was old and unused (ie grafana-docker repo is the place for the offical production docker container --- docker/production/Dockerfile | 16 --------------- docker/production/README.md | 31 ----------------------------- docker/production/build.sh | 15 -------------- docker/production/test_container.sh | 5 ----- 4 files changed, 67 deletions(-) delete mode 100644 docker/production/Dockerfile delete mode 100644 docker/production/README.md delete mode 100755 docker/production/build.sh delete mode 100755 docker/production/test_container.sh diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile deleted file mode 100644 index 5017c2c1a36..00000000000 --- a/docker/production/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM debian:jessie - -RUN apt-get -y update -RUN apt-get -y install libfontconfig - -RUN mkdir -p /opt/grafana - -ADD tmp/ /opt/grafana/ - -EXPOSE 3000 - -VOLUME ["/opt/grafana/data"] -VOLUME ["/opt/grafana/conf"] - -WORKDIR /opt/grafana/ -ENTRYPOINT ["./grafana", "web"] diff --git a/docker/production/README.md b/docker/production/README.md deleted file mode 100644 index 9c25c48adc2..00000000000 --- a/docker/production/README.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Grafana docker image - -This container currently only contains the in development alpha of Grafana 2.0 (ie non production use). The -`#develop` tag is constantly updated as we make progress towards a beta release. - - -## Running your Grafana image --------------------------- - -Start your image binding the external port `3000`. - - docker run -i -p 3000:3000 grafana/grafana - -Try it out, default admin user is admin/admin. - - -## Configuring your Grafana container - -All options defined in conf/grafana.ini can be overridden using environment variables, for example: - - -``` -docker run -i -p 3000:3000 \ - -e "GF_SERVER_ROOT_URL=http://grafana.server.name" \ - -e "GF_SECURITY_ADMIN_PASSWORD=secret" \ - grafana/grafana:develop -``` - - - diff --git a/docker/production/build.sh b/docker/production/build.sh deleted file mode 100755 index d97b29de934..00000000000 --- a/docker/production/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -cp Dockerfile ../../ -cd ../../ - -go run build.go build - -grunt release - -docker build --tag "grafana/grafana:develop" . - -rm Dockerfile -cd docker/production - - diff --git a/docker/production/test_container.sh b/docker/production/test_container.sh deleted file mode 100755 index aa8fdba4cbf..00000000000 --- a/docker/production/test_container.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -docker run -i -p 3001:3000 \ - -e "GF_SERVER_ROOT_URL=http://grafana.server.name" \ - grafana/grafana:develop From 5777f65d05a8dc141c34e470ef1d5fe956f8173c Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Tue, 13 Dec 2016 00:15:52 -0800 Subject: [PATCH 3/7] Basic Auth now supports LDAP username and password (#6940) --- docs/sources/http_api/auth.md | 2 +- pkg/middleware/middleware.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/sources/http_api/auth.md b/docs/sources/http_api/auth.md index becc3758830..aaeda1105b1 100644 --- a/docs/sources/http_api/auth.md +++ b/docs/sources/http_api/auth.md @@ -18,7 +18,7 @@ Currently you can authenticate via an `API Token` or via a `Session cookie` (acq ## Basic Auth If basic auth is enabled (it is enabled by default) you can authenticate your HTTP request via -standard basic auth. +standard basic auth. Basic auth will also authenticate LDAP users. curl example: ``` diff --git a/pkg/middleware/middleware.go b/pkg/middleware/middleware.go index 7a64656b0ee..4b59fada62e 100644 --- a/pkg/middleware/middleware.go +++ b/pkg/middleware/middleware.go @@ -9,6 +9,7 @@ import ( "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/components/apikeygen" "github.com/grafana/grafana/pkg/log" + l "github.com/grafana/grafana/pkg/login" "github.com/grafana/grafana/pkg/metrics" m "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/setting" @@ -137,6 +138,7 @@ func initContextWithApiKey(ctx *Context) bool { } func initContextWithBasicAuth(ctx *Context) bool { + if !setting.BasicAuthEnabled { return false } @@ -160,9 +162,9 @@ func initContextWithBasicAuth(ctx *Context) bool { user := loginQuery.Result - // validate password - if util.EncodePassword(password, user.Salt) != user.Password { - ctx.JsonApiErr(401, "Invalid username or password", nil) + loginUserQuery := l.LoginUserQuery{Username: username, Password: password, User: user} + if err := bus.Dispatch(&loginUserQuery); err != nil { + ctx.JsonApiErr(401, "Invalid username or password", err) return true } From 62d18cd493d13f85815e55e07982a5eb89310803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 13 Dec 2016 09:18:10 +0100 Subject: [PATCH 4/7] docs(): updated changelog with PR #6940 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49cc8611019..91485452e64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * **Elasticsearch**: Added support for Elasticsearch 5.x [#6356](https://github.com/grafana/grafana/pull/6356), thx [@lpic10](https://github.com/lpic10) * **CLI**: Make it possible to reset the admin password using the grafana-cli. [#5479](https://github.com/grafana/grafana/issues/5479) * **Influxdb**: Support multiple tags in InfluxDB annotations. [#4550](https://github.com/grafana/grafana/pull/4550), thx [@adrianlzt](https://github.com/adrianlzt) +* **LDAP**: Basic Auth now supports LDAP username and password, [#6940](https://github.com/grafana/grafana/pull/6940), thx [@utkarshcmu](https://github.com/utkarshcmu) ### Bugfixes * **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679) From 76f78c0f720bd87b450f9f69b6b03705abbe5caf Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 13 Dec 2016 09:49:33 +0100 Subject: [PATCH 5/7] test(alert_tab): basic test skeleton I created this test by misstake. But instead of deleting it I thought it might be good to keep it to make it easier to add tests for the alert tab --- .../alerting/specs/alert_tab_specs.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 public/app/features/alerting/specs/alert_tab_specs.ts diff --git a/public/app/features/alerting/specs/alert_tab_specs.ts b/public/app/features/alerting/specs/alert_tab_specs.ts new file mode 100644 index 00000000000..3c407297dee --- /dev/null +++ b/public/app/features/alerting/specs/alert_tab_specs.ts @@ -0,0 +1,20 @@ +import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; + +import {AlertTabCtrl} from '../alert_tab_ctrl'; +import helpers from '../../../../test/specs/helpers'; + +describe('AlertTabCtrl', () => { + var $scope = { + ctrl: {} + }; + + describe('with null parameters', () => { + it('can be created', () => { + var alertTab = new AlertTabCtrl($scope, null, null, null, null, null, null, null); + + expect(alertTab).to.not.be(null); + }); + }); +}); + + From bd20dc6c4ca8b232d19acaf56e957fc9dc020f73 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Tue, 13 Dec 2016 01:00:33 -0800 Subject: [PATCH 6/7] Fixed failing tests (#6941) --- pkg/middleware/middleware_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/middleware/middleware_test.go b/pkg/middleware/middleware_test.go index f8e4aa374e8..5db4e59d29e 100644 --- a/pkg/middleware/middleware_test.go +++ b/pkg/middleware/middleware_test.go @@ -9,6 +9,7 @@ import ( "github.com/go-macaron/session" "github.com/grafana/grafana/pkg/bus" + l "github.com/grafana/grafana/pkg/login" m "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/util" @@ -58,6 +59,10 @@ func TestMiddlewareContext(t *testing.T) { return nil }) + bus.AddHandler("test", func(loginUserQuery *l.LoginUserQuery) error { + return nil + }) + bus.AddHandler("test", func(query *m.GetSignedInUserQuery) error { query.Result = &m.SignedInUser{OrgId: 2, UserId: 12} return nil From b620c7457d95728a71be8d6606a916f35ee42da3 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 13 Dec 2016 10:45:40 +0100 Subject: [PATCH 7/7] test(query_editor): adds test for nesting queries in targetFull --- .../graphite/specs/query_ctrl_specs.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts index 8c191bba528..663400a7dd5 100644 --- a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts @@ -160,4 +160,27 @@ describe('GraphiteQueryCtrl', function() { expect(ctx.panelCtrl.refresh.called).to.be(true); }); }); + + describe('when updating targets with nested query', function() { + beforeEach(function() { + ctx.ctrl.target.target = 'scaleToSeconds(#A)'; + ctx.ctrl.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([{expandable: false}])); + ctx.ctrl.parseTarget(); + + ctx.ctrl.panelCtrl.panel.targets = [ { + target: 'nested.query.count', + refId: 'A' + }]; + + ctx.ctrl.updateModelTarget(); + }); + + it('target should remain the same', function() { + expect(ctx.ctrl.target.target).to.be('scaleToSeconds(#A)'); + }); + + it('targetFull should include nexted queries', function() { + expect(ctx.ctrl.target.targetFull).to.be('scaleToSeconds(nested.query.count)'); + }); + }); });