Repository: ambari Updated Branches: refs/heads/trunk 1c1488941 -> 0777ae563
AMBARI-19341. Not able to update the role for a given user (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0777ae56 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0777ae56 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0777ae56 Branch: refs/heads/trunk Commit: 0777ae5634c25e7b8bed03f872e17759e4e80f73 Parents: 1c14889 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Wed Jan 4 18:39:05 2017 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Thu Jan 5 10:32:12 2017 +0200 ---------------------------------------------------------------------- .../app/scripts/controllers/clusters/UserAccessListCtrl.js | 7 ++++--- .../ui/admin-web/app/views/clusters/userAccessList.html | 2 +- .../ui/admin-web/test/unit/services/PermissionSaver_test.js | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0777ae56/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 4f00aeb..9869d0b 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 @@ -166,9 +166,10 @@ function($scope, $location, Cluster, $modal, $rootScope, $routeParams, Permissio // Process when it's NONE privilege or higher than current effective group privilege if (userIndex <= groupIndex || user.permission_name == $scope.NONE_ROLE.permission_name) { - var privilege_ids = []; - privilegesOfTypeUser.forEach(function(privilegeOfTypeUser) { - privilege_ids.push(privilegeOfTypeUser.privilege_id); + var privilege_ids = privilegesOfTypeUser.filter(function(privilegeOfTypeUser) { + return privilegeOfTypeUser.principal_type !== 'ROLE'; + }).map(function (privilegeOfTypeUser) { + return privilegeOfTypeUser.privilege_id; }); // Purge existing user level privileges if there is any http://git-wip-us.apache.org/repos/asf/ambari/blob/0777ae56/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html index 7b54f9f..8b29157 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html +++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html @@ -68,7 +68,7 @@ </td> <td> <div ng-show="!user.editable">{{user.permission_label}}</div> - <select class="role-select" ng-show="user.editable" ng-model="user.permission_name" + <select class="form-control role-select" ng-show="user.editable" ng-model="user.permission_name" ng-options="role.permission_name as role.permission_label for role in roleValueOptions"> </select> <span ng-show="user.principal_type != $parent.currentTypeFilter.value"> {{'common.fromGroupMark' | translate}}</span> http://git-wip-us.apache.org/repos/asf/ambari/blob/0777ae56/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/PermissionSaver_test.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/PermissionSaver_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/PermissionSaver_test.js index 6c662f2..6a409e4 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/PermissionSaver_test.js +++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/PermissionSaver_test.js @@ -40,6 +40,7 @@ describe('PermissionSaver Service', function () { PermissionInfo: { permission_name: 'CLUSTER.ADMINISTRATOR' }, + ROLE: {}, USER: ['u0', 'u1', 'g0'], GROUP: ['g0', 'g1', 'u0'] }, @@ -47,6 +48,7 @@ describe('PermissionSaver Service', function () { PermissionInfo: { permission_name: 'CLUSTER.OPERATOR' }, + ROLE: {}, USER: ['g1'], GROUP: ['u1'] } @@ -118,6 +120,7 @@ describe('PermissionSaver Service', function () { PermissionInfo: { permission_name: 'CLUSTER.ADMINISTRATOR' }, + ROLE: {}, USER: ['u0', 'u1'], GROUP: ['g0', 'g1'] }, @@ -125,6 +128,7 @@ describe('PermissionSaver Service', function () { PermissionInfo: { permission_name: 'CLUSTER.OPERATOR' }, + ROLE: {}, USER: ['u0'], GROUP: ['g2'] }, @@ -132,6 +136,7 @@ describe('PermissionSaver Service', function () { PermissionInfo: { permission_name: 'CLUSTER.USER' }, + ROLE: {}, USER: ['u2'], GROUP: ['g0'] }