mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 19:30:36 -06:00
Merge branch 'master' of github.com:grafana/grafana
This commit is contained in:
commit
f8a4661d05
@ -115,6 +115,7 @@ func Register(r *macaron.Macaron) {
|
||||
r.Get("/:id", wrap(GetUserById))
|
||||
r.Get("/:id/orgs", wrap(GetUserOrgList))
|
||||
r.Put("/:id", bind(m.UpdateUserCommand{}), wrap(UpdateUser))
|
||||
r.Post("/:id/using/:orgId", wrap(UpdateUserActiveOrg))
|
||||
}, reqGrafanaAdmin)
|
||||
|
||||
// org information available to all users.
|
||||
|
@ -55,6 +55,13 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht
|
||||
req.Header.Add("Authorization", util.GetBasicAuthHeader(ds.BasicAuthUser, ds.BasicAuthPassword))
|
||||
}
|
||||
|
||||
dsAuth := req.Header.Get("X-DS-Authorization")
|
||||
if len(dsAuth) > 0 {
|
||||
req.Header.Del("X-DS-Authorization")
|
||||
req.Header.Del("Authorization")
|
||||
req.Header.Add("Authorization", dsAuth)
|
||||
}
|
||||
|
||||
// clear cookie headers
|
||||
req.Header.Del("Cookie")
|
||||
req.Header.Del("Set-Cookie")
|
||||
|
@ -40,6 +40,24 @@ func UpdateUser(c *middleware.Context, cmd m.UpdateUserCommand) Response {
|
||||
return handleUpdateUser(cmd)
|
||||
}
|
||||
|
||||
//POST /api/users/:id/using/:orgId
|
||||
func UpdateUserActiveOrg(c *middleware.Context) Response {
|
||||
userId := c.ParamsInt64(":id")
|
||||
orgId := c.ParamsInt64(":orgId")
|
||||
|
||||
if !validateUsingOrg(userId, orgId) {
|
||||
return ApiError(401, "Not a valid organization", nil)
|
||||
}
|
||||
|
||||
cmd := m.SetUsingOrgCommand{UserId: userId, OrgId: orgId}
|
||||
|
||||
if err := bus.Dispatch(&cmd); err != nil {
|
||||
return ApiError(500, "Failed change active organization", err)
|
||||
}
|
||||
|
||||
return ApiSuccess("Active organization changed")
|
||||
}
|
||||
|
||||
func handleUpdateUser(cmd m.UpdateUserCommand) Response {
|
||||
if len(cmd.Login) == 0 {
|
||||
cmd.Login = cmd.Email
|
||||
|
@ -96,6 +96,11 @@ function (angular, _, coreModule, config) {
|
||||
var requestIsLocal = options.url.indexOf('/') === 0;
|
||||
var firstAttempt = options.retry === 0;
|
||||
|
||||
if (requestIsLocal && options.headers && options.headers.Authorization) {
|
||||
options.headers['X-DS-Authorization'] = options.headers.Authorization;
|
||||
delete options.headers.Authorization;
|
||||
}
|
||||
|
||||
return $http(options).then(null, function(err) {
|
||||
// handle unauthorized for backend requests
|
||||
if (requestIsLocal && firstAttempt && err.status === 401) {
|
||||
|
@ -1,9 +1,5 @@
|
||||
<div class="main">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="panel nospace" ng-if="panel" style="width: 100%">
|
||||
<plugin-component type="panel">
|
||||
</plugin-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel nospace" ng-if="panel" style="width: 100%">
|
||||
<plugin-component type="panel">
|
||||
</plugin-component>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
4
vendor/phantomjs/render.js
vendored
4
vendor/phantomjs/render.js
vendored
@ -39,7 +39,8 @@
|
||||
var canvas = page.evaluate(function() {
|
||||
if (!window.angular) { return false; }
|
||||
var body = window.angular.element(document.body);
|
||||
if (!body.scope) { return false; }
|
||||
if (!body.injector) { return false; }
|
||||
if (!body.injector()) { return false; }
|
||||
|
||||
var rootScope = body.injector().get('$rootScope');
|
||||
if (!rootScope) {return false;}
|
||||
@ -59,6 +60,7 @@
|
||||
width: bb.width,
|
||||
height: bb.height
|
||||
};
|
||||
|
||||
page.render(params.png);
|
||||
phantom.exit();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user