ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject [1/2] ambari git commit: AMBARI-17142. RBAC: Roles show "empty" user after delete (akovalenko)
Date Thu, 09 Jun 2016 14:49:32 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 a998371a4 -> ef6e9890c


AMBARI-17142. RBAC: Roles show "empty" user after delete (akovalenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d7044ae7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d7044ae7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d7044ae7

Branch: refs/heads/branch-2.4
Commit: d7044ae7d2d09d910cc957b2158878a43e8eef9c
Parents: a998371
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Thu Jun 9 17:15:11 2016 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Thu Jun 9 17:47:34 2016 +0300

----------------------------------------------------------------------
 .../controllers/clusters/UserAccessListCtrl.js  |  2 +-
 .../scripts/controllers/users/UsersShowCtrl.js  | 26 +++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d7044ae7/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
index 10bb53b..4f00aeb 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
@@ -142,7 +142,7 @@ function($scope, $location, Cluster, $modal, $rootScope, $routeParams,
Permissio
     if ($scope.isUserActive) {
       Cluster.getPrivilegesForResource({
           nameFilter : user.user_name,
-          typeFilter : $scope.currentTypeFilter,
+          typeFilter : $scope.currentTypeFilter
       }).then(function(data) {
         var arrayOfPrivileges = data.items[0].privileges;
         var privilegesOfTypeUser = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7044ae7/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
index f93a368..386c499 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('UsersShowCtrl', ['$scope', '$routeParams', 'User', '$modal', '$location', 'ConfirmationModal',
'Alert', 'Auth', 'getDifference', 'Group', '$q', '$translate', function($scope, $routeParams,
User, $modal, $location, ConfirmationModal, Alert, Auth, getDifference, Group, $q, $translate)
{
+.controller('UsersShowCtrl', ['$scope', '$routeParams', 'Cluster', 'User', '$modal', '$location',
'ConfirmationModal', 'Alert', 'Auth', 'getDifference', 'Group', '$q', '$translate', function($scope,
$routeParams, Cluster, User, $modal, $location, ConfirmationModal, Alert, Auth, getDifference,
Group, $q, $translate) {
 
   var $t = $translate.instant;
 
@@ -179,8 +179,28 @@ angular.module('ambariAdminConsole')
         instanceName: '"' + $scope.user.user_name + '"'
       })
     ).then(function() {
-      User.delete($scope.user.user_name).then(function() {
-        $location.path('/users');
+      Cluster.getPrivilegesForResource({
+        nameFilter : $scope.user.user_name,
+        typeFilter : {value: 'USER'}
+      }).then(function(data) {
+        var privilegesIds = [];
+        var deleteCallback = function () {
+          User.delete($scope.user.user_name).then(function() {
+            $location.path('/users');
+          });
+        };
+        if (data.items && data.items.length) {
+          angular.forEach(data.items[0].privileges, function(privilege) {
+            privilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+          });
+        }
+        if (privilegesIds.length) {
+          Cluster.deleteMultiplePrivileges($routeParams.id, privilegesIds).then(function()
{
+            deleteCallback();
+          });
+        } else {
+          deleteCallback();
+        }
       });
     });
   };


Mime
View raw message