ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-17169. RBAC: Roles show "empty" group after delete (akovalenko)
Date Mon, 13 Jun 2016 09:21:51 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 81b06bbb2 -> 2ecf374c2


AMBARI-17169. RBAC: Roles show "empty" group 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/2ecf374c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2ecf374c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2ecf374c

Branch: refs/heads/trunk
Commit: 2ecf374c2526f18d40af5beba70c591840945c05
Parents: 81b06bb
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Fri Jun 10 17:51:51 2016 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Mon Jun 13 12:12:50 2016 +0300

----------------------------------------------------------------------
 .../controllers/groups/GroupsEditCtrl.js        | 30 ++++++++++++++++----
 .../scripts/controllers/users/UsersShowCtrl.js  |  4 ++-
 2 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ecf374c/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
index a8411dd..68bf3e5 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('GroupsEditCtrl',['$scope', 'Group', '$routeParams', 'Alert', 'ConfirmationModal',
'$location', '$translate', function($scope, Group, $routeParams, Alert, ConfirmationModal,
$location, $translate) {
+.controller('GroupsEditCtrl',['$scope', 'Group', '$routeParams', 'Cluster', 'Alert', 'ConfirmationModal',
'$location', '$translate', function($scope, Group, $routeParams, Cluster, Alert, ConfirmationModal,
$location, $translate) {
   var $t = $translate.instant;
   $scope.constants = {
     group: $t('common.group'),
@@ -88,10 +88,30 @@ angular.module('ambariAdminConsole')
         instanceName: '"' + group.group_name + '"'
       })
     ).then(function() {
-      group.destroy().then(function() {
-        $location.path('/groups');
-      }).catch(function() {
-        
+      Cluster.getPrivilegesForResource({
+        nameFilter : group.group_name,
+        typeFilter : {value: 'GROUP'}
+      }).then(function(data) {
+        var deleteCallback = function () {
+          group.destroy().then(function() {
+            $location.path('/groups');
+          });
+        };
+        var privilegesIds = [];
+        if (data.items && data.items.length) {
+          angular.forEach(data.items[0].privileges, function(privilege) {
+            if (privilege.PrivilegeInfo.principal_type === 'GROUP') {
+              privilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+            }
+          });
+        }
+        if (privilegesIds.length) {
+          Cluster.deleteMultiplePrivileges($routeParams.id, privilegesIds).then(function()
{
+            deleteCallback();
+          });
+        } else {
+          deleteCallback();
+        }
       });
     });
   };

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ecf374c/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 386c499..69a15bd 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
@@ -191,7 +191,9 @@ angular.module('ambariAdminConsole')
         };
         if (data.items && data.items.length) {
           angular.forEach(data.items[0].privileges, function(privilege) {
-            privilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+            if (privilege.PrivilegeInfo.principal_type === 'USER') {
+              privilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+            }
           });
         }
         if (privilegesIds.length) {


Mime
View raw message