diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a313e91013..91485452e64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ * **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) +* **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) 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 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 } 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 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); + }); + }); +}); + + 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)'); + }); + }); });