Small progress on #2014

This commit is contained in:
Torkel Ödegaard 2015-05-19 09:09:21 +02:00
parent bf9e51928d
commit 74bf1f23fb
3 changed files with 24 additions and 1 deletions

View File

@ -67,7 +67,7 @@ func Register(r *macaron.Macaron) {
// users
r.Group("/users", func() {
r.Get("/:id", wrap(GetUserById))
r.Get("/:id/org", wrap(GetUserOrgList))
r.Get("/:id/orgs", wrap(GetUserOrgList))
r.Put("/:id", bind(m.UpdateUserCommand{}), wrap(UpdateUser))
}, reqGrafanaAdmin)

View File

@ -13,6 +13,7 @@ function (angular) {
$scope.init = function() {
if ($routeParams.id) {
$scope.getUser($routeParams.id);
$scope.getUserOrgs($routeParams.id);
}
};
@ -49,6 +50,12 @@ function (angular) {
});
};
$scope.getUserOrgs = function(id) {
backendSrv.get('/api/users/' + id + '/orgs').then(function(orgs) {
$scope.orgs = orgs;
});
};
$scope.update = function() {
if (!$scope.userForm.$valid) { return; }

View File

@ -94,5 +94,21 @@
<br>
<button type="submit" class="pull-right btn btn-success" ng-click="updatePermissions()">Update</button>
<h2>
Organizations
</h2>
<table class="grafana-options-table">
<tr ng-repeat="org in orgs">
<td style="width: 98%"><strong>Name: </strong> {{org.name}}</td>
<td><strong>Role: </strong> {{org.role}}</td>
<td class="nobg max-width-btns">
<span class="label label-info" ng-show="org.orgId === user.orgId">
Current
</span>
</td>
</tr>
</table>
</div>
</div>