ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rz...@apache.org
Subject ambari git commit: AMBARI-17077 - Unable to change user role in list view (rzang)
Date Tue, 07 Jun 2016 18:46:11 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 9aa19d427 -> 88c8d46cb


AMBARI-17077 - Unable to change user role in list view (rzang)


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

Branch: refs/heads/branch-2.4
Commit: 88c8d46cb9c7835aff27c841bf64ad7fd0efca56
Parents: 9aa19d4
Author: Richard Zang <rzang@apache.org>
Authored: Tue Jun 7 11:43:25 2016 -0700
Committer: Richard Zang <rzang@apache.org>
Committed: Tue Jun 7 11:45:37 2016 -0700

----------------------------------------------------------------------
 .../controllers/clusters/UserAccessListCtrl.js       | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/88c8d46c/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 cd72ca6..10bb53b 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
@@ -161,20 +161,17 @@ function($scope, $location, Cluster, $modal, $rootScope, $routeParams,
Permissio
         user.original_perm = effectivePrivilege.permission_name;
         user.editable = (Cluster.ineditableRoles.indexOf(effectivePrivilege.permission_name)
=== -1);
 
-        //add a new privilege of type USER only if it is also the effective privilege considering
the user's Group privileges
-        var curIndex = $scope.getRoleRank(user.permission_name);
-        var prevIndex = -1;
-        if (privilegesOfTypeGroup.length !== 0) {
-          prevIndex = $scope.getRoleRank(effectivePrivilegeFromGroups.permission_name);
-        }
-        if ((curIndex === 6) || (curIndex <= prevIndex)) {
+        var userIndex = $scope.getRoleRank(user.permission_name);
+        var groupIndex = $scope.getRoleRank(effectivePrivilegeFromGroups.permission_name);
+
+        // 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);
           });
 
-          //delete all privileges of type USER, if they exist
-          //then add the privilege for the user, after which the user displays the effective
privilege
+          // Purge existing user level privileges if there is any
           if(privilege_ids.length !== 0) {
             Cluster.deleteMultiplePrivileges(
                 $routeParams.id,


Mime
View raw message