Browse Source

Merge branch 'master' into alerting_mqe

bergquist 9 years ago
parent
commit
e6c557bb91

+ 2 - 1
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 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)
 * **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)
 * **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
 ### Bugfixes
 * **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679)
 * **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679)

+ 0 - 16
docker/production/Dockerfile

@@ -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"]

+ 0 - 31
docker/production/README.md

@@ -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
-```
-
-
-

+ 0 - 15
docker/production/build.sh

@@ -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
-
-

+ 0 - 5
docker/production/test_container.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-docker run -i -p 3001:3000 \
-  -e "GF_SERVER_ROOT_URL=http://grafana.server.name"  \
-  grafana/grafana:develop

+ 1 - 1
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
 ## Basic Auth
 
 
 If basic auth is enabled (it is enabled by default) you can authenticate your HTTP request via
 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:
 curl example:
 ```
 ```

+ 5 - 3
pkg/middleware/middleware.go

@@ -9,6 +9,7 @@ import (
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/components/apikeygen"
 	"github.com/grafana/grafana/pkg/components/apikeygen"
 	"github.com/grafana/grafana/pkg/log"
 	"github.com/grafana/grafana/pkg/log"
+	l "github.com/grafana/grafana/pkg/login"
 	"github.com/grafana/grafana/pkg/metrics"
 	"github.com/grafana/grafana/pkg/metrics"
 	m "github.com/grafana/grafana/pkg/models"
 	m "github.com/grafana/grafana/pkg/models"
 	"github.com/grafana/grafana/pkg/setting"
 	"github.com/grafana/grafana/pkg/setting"
@@ -137,6 +138,7 @@ func initContextWithApiKey(ctx *Context) bool {
 }
 }
 
 
 func initContextWithBasicAuth(ctx *Context) bool {
 func initContextWithBasicAuth(ctx *Context) bool {
+
 	if !setting.BasicAuthEnabled {
 	if !setting.BasicAuthEnabled {
 		return false
 		return false
 	}
 	}
@@ -160,9 +162,9 @@ func initContextWithBasicAuth(ctx *Context) bool {
 
 
 	user := loginQuery.Result
 	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
 		return true
 	}
 	}
 
 

+ 5 - 0
pkg/middleware/middleware_test.go

@@ -9,6 +9,7 @@ import (
 
 
 	"github.com/go-macaron/session"
 	"github.com/go-macaron/session"
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/bus"
+	l "github.com/grafana/grafana/pkg/login"
 	m "github.com/grafana/grafana/pkg/models"
 	m "github.com/grafana/grafana/pkg/models"
 	"github.com/grafana/grafana/pkg/setting"
 	"github.com/grafana/grafana/pkg/setting"
 	"github.com/grafana/grafana/pkg/util"
 	"github.com/grafana/grafana/pkg/util"
@@ -58,6 +59,10 @@ func TestMiddlewareContext(t *testing.T) {
 				return nil
 				return nil
 			})
 			})
 
 
+			bus.AddHandler("test", func(loginUserQuery *l.LoginUserQuery) error {
+				return nil
+			})
+
 			bus.AddHandler("test", func(query *m.GetSignedInUserQuery) error {
 			bus.AddHandler("test", func(query *m.GetSignedInUserQuery) error {
 				query.Result = &m.SignedInUser{OrgId: 2, UserId: 12}
 				query.Result = &m.SignedInUser{OrgId: 2, UserId: 12}
 				return nil
 				return nil

+ 20 - 0
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);
+    });
+  });
+});
+
+

+ 23 - 0
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);
       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)');
+    });
+  });
 });
 });