adminUsersCtrl.js 806 B

12345678910111213141516171819202122232425262728293031323334353637
  1. define([
  2. 'angular',
  3. ],
  4. function (angular) {
  5. 'use strict';
  6. var module = angular.module('grafana.controllers');
  7. module.controller('AdminUsersCtrl', function($scope, backendSrv) {
  8. $scope.init = function() {
  9. $scope.getUsers();
  10. };
  11. $scope.getUsers = function() {
  12. backendSrv.get('/api/admin/users').then(function(users) {
  13. $scope.users = users;
  14. });
  15. };
  16. $scope.deleteUser = function(user) {
  17. $scope.appEvent('confirm-modal', {
  18. title: 'Do you want to delete ' + user.login + '?',
  19. icon: 'fa-trash',
  20. yesText: 'Delete',
  21. onConfirm: function() {
  22. backendSrv.delete('/api/admin/users/' + user.id).then(function() {
  23. $scope.getUsers();
  24. });
  25. }
  26. });
  27. };
  28. $scope.init();
  29. });
  30. });