Commit 74bf1f23 by Torkel Ödegaard

Small progress on #2014

parent bf9e5192
......@@ -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)
......
......@@ -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; }
......
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment