You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mr...@apache.org on 2017/11/27 23:29:39 UTC

[27/30] ambari git commit: Merge trunk with feature branch and fix some UT compilation issues (mradhakrishnan)

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/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
deleted file mode 100644
index a63ebe2..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-.controller('GroupsEditCtrl',['$scope', 'Group', '$routeParams', 'Cluster', 'View', 'Alert', 'ConfirmationModal', '$location', 'GroupConstants', '$translate', function($scope, Group, $routeParams, Cluster, View, Alert, ConfirmationModal, $location, GroupConstants, $translate) {
-  var $t = $translate.instant;
-  $scope.constants = {
-    group: $t('common.group'),
-    view: $t('common.view').toLowerCase(),
-    cluster: $t('common.cluster').toLowerCase()
-  };
-  $scope.editMode = false;
-  $scope.group = new Group($routeParams.id);
-  $scope.group.editingUsers = [];
-  $scope.groupMembers = [];
-  $scope.dataLoaded = false;
-  
-  $scope.isMembersEditing = false;
-
-  $scope.$watch(function() {
-    return $scope.group.editingUsers;
-  }, function(newValue) {
-    if(newValue && !angular.equals(newValue, $scope.groupMembers)){
-      $scope.updateMembers();  
-    }
-  }, true);
-  
-  $scope.enableMembersEditing = function() {
-    $scope.isMembersEditing = true;
-    $scope.group.editingUsers = angular.copy($scope.groupMembers);
-  };
-  $scope.cancelUpdate = function() {
-    $scope.isMembersEditing = false;
-    $scope.group.editingUsers = '';
-  };
-  $scope.updateMembers = function() {
-    var newMembers = $scope.group.editingUsers.toString().split(',').filter(function(item) {
-      return item.trim();}
-    ).map(function(item) {
-        return item.trim()
-      }
-    );
-    $scope.group.members = newMembers;
-    $scope.group.saveMembers().catch(function(data) {
-        Alert.error($t('groups.alerts.cannotUpdateGroupMembers'), "<div class='break-word'>" + data.message + "</div>");
-      }).finally(function() {
-        loadMembers();
-      });
-    $scope.isMembersEditing = false;
-  };
-
-
-  function loadMembers(){
-    $scope.group.getMembers().then(function(members) {
-      $scope.group.groupTypeName = $t(GroupConstants.TYPES[$scope.group.group_type].LABEL_KEY);
-      $scope.groupMembers = members;
-      $scope.group.editingUsers = angular.copy($scope.groupMembers);
-    });
-  }    
-  
-  $scope.group.isLDAP().then(function(isLDAP) {
-    $scope.group.ldap_group = isLDAP;
-    $scope.group.getGroupType().then(function() {
-      $scope.group.groupTypeName = $t(GroupConstants.TYPES[$scope.group.group_type].LABEL_KEY);
-    });
-    loadMembers();
-  });
-
-  $scope.group.getGroupType();
-
-  $scope.deleteGroup = function(group) {
-    ConfirmationModal.show(
-      $t('common.delete', {
-        term: $t('common.group')
-      }),
-      $t('common.deleteConfirmation', {
-        instanceType: $t('common.group').toLowerCase(),
-        instanceName: '"' + group.group_name + '"'
-      })
-    ).then(function() {
-      Cluster.getPrivilegesForResource({
-        nameFilter : group.group_name,
-        typeFilter : {value: 'GROUP'}
-      }).then(function(data) {
-        var clusterPrivilegesIds = [];
-        var viewsPrivileges = [];
-        if (data.items && data.items.length) {
-          angular.forEach(data.items[0].privileges, function(privilege) {
-            if (privilege.PrivilegeInfo.principal_type === 'GROUP') {
-              if (privilege.PrivilegeInfo.type === 'VIEW') {
-                viewsPrivileges.push({
-                  id: privilege.PrivilegeInfo.privilege_id,
-                  view_name: privilege.PrivilegeInfo.view_name,
-                  version: privilege.PrivilegeInfo.version,
-                  instance_name: privilege.PrivilegeInfo.instance_name
-                });
-              } else {
-                clusterPrivilegesIds.push(privilege.PrivilegeInfo.privilege_id);
-              }
-            }
-          });
-        }
-        group.destroy().then(function() {
-          $location.path('/groups');
-          if (clusterPrivilegesIds.length) {
-            Cluster.getAllClusters().then(function (clusters) {
-              var clusterName = clusters[0].Clusters.cluster_name;
-              Cluster.deleteMultiplePrivileges(clusterName, clusterPrivilegesIds);
-            });
-          }
-          angular.forEach(viewsPrivileges, function(privilege) {
-            View.deletePrivilege(privilege);
-          });
-        });
-      });
-    });
-  };
-
-
-  $scope.removePrivilege = function(name, privilege) {
-    var privilegeObject = {
-        id: privilege.privilege_id,
-        view_name: privilege.view_name,
-        version: privilege.version,
-        instance_name: name
-    };
-    View.deletePrivilege(privilegeObject).then(function() {
-      loadPrivileges();
-    });
-  };
-
-function loadPrivileges() {
-  // Load privileges
-  Group.getPrivileges($routeParams.id).then(function(data) {
-    var privileges = {
-      clusters: {},
-      views: {}
-    };
-    angular.forEach(data.data.items, function(privilege) {
-      privilege = privilege.PrivilegeInfo;
-      if(privilege.type === 'CLUSTER'){
-        // This is cluster
-        privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name] || [];
-        privileges.clusters[privilege.cluster_name].push(privilege.permission_label);
-      } else if ( privilege.type === 'VIEW'){
-        privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || { privileges:[]};
-        privileges.views[privilege.instance_name].version = privilege.version;
-        privileges.views[privilege.instance_name].view_name = privilege.view_name;
-        privileges.views[privilege.instance_name].privilege_id = privilege.privilege_id;
-        privileges.views[privilege.instance_name].privileges.push(privilege.permission_label);
-      }
-    });
-
-    $scope.privileges = data.data.items.length ? privileges : null;
-    $scope.noClusterPriv = $.isEmptyObject(privileges.clusters);
-    $scope.noViewPriv = $.isEmptyObject(privileges.views);
-    $scope.hidePrivileges = $scope.noClusterPriv && $scope.noViewPriv;
-    $scope.dataLoaded = true;
-  }).catch(function(data) {
-    Alert.error($t('common.alerts.cannotLoadPrivileges'), data.data.message);
-  });
-}
-loadPrivileges();
-}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
deleted file mode 100644
index 7cc590e..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-.controller('GroupsListCtrl',['$scope', 'Group', '$modal', 'ConfirmationModal', '$rootScope', 'GroupConstants', '$translate', function($scope, Group, $modal, ConfirmationModal, $rootScope, GroupConstants, $translate) {
-  var $t = $translate.instant;
-  $scope.constants = {
-    groups: $t('common.groups').toLowerCase()
-  };
-  $scope.isLoading = false;
-  $scope.groups = [];
-
-  $scope.groupsPerPage = 10;
-  $scope.currentPage = 1;
-  $scope.totalGroups = 1;
-  $scope.currentNameFilter = '';
-  $scope.maxVisiblePages=20;
-  $scope.tableInfo = {
-    total: 0,
-    showed: 0
-  };
-  $scope.isNotEmptyFilter = true;
-
-  $scope.pageChanged = function() {
-    loadGroups();
-  };
-  $scope.groupsPerPageChanges = function() {
-    loadGroups();
-  };
-
-  $scope.resetPagination = function() {
-    $scope.currentPage = 1;
-    loadGroups();
-  };
-
-  function loadGroups(){
-    $scope.isLoading = true;
-    Group.all({
-      currentPage: $scope.currentPage, 
-      groupsPerPage: $scope.groupsPerPage, 
-      searchString: $scope.currentNameFilter,
-      group_type: $scope.currentTypeFilter.value
-    }).then(function(groups) {
-      $scope.isLoading = false;
-      $scope.totalGroups = groups.itemTotal;
-      $scope.groups = groups.map(Group.makeGroup);
-      $scope.tableInfo.total = groups.itemTotal;
-      $scope.tableInfo.showed = groups.length;
-    })
-    .catch(function(data) {
-      console.error($t('groups.alerts.getGroupsListError'));
-    });
-  }
-
-  $scope.typeFilterOptions = [{ label: $t('common.all'), value: '*'}]
-    .concat(Object.keys(GroupConstants.TYPES).map(function(key) {
-      return {
-        label: $t(GroupConstants.TYPES[key].LABEL_KEY),
-        value: GroupConstants.TYPES[key].VALUE
-      };
-  }));
-  $scope.currentTypeFilter = $scope.typeFilterOptions[0];
-
-  $scope.clearFilters = function () {
-    $scope.currentNameFilter = '';
-    $scope.currentTypeFilter = $scope.typeFilterOptions[0];
-    $scope.resetPagination();
-  };
-  
-  loadGroups();
-
-  $scope.$watch(
-    function (scope) {
-      return Boolean(scope.currentNameFilter || (scope.currentTypeFilter && scope.currentTypeFilter.value !== '*'));
-    },
-    function (newValue, oldValue, scope) {
-      scope.isNotEmptyFilter = newValue;
-    }
-  );
-
-  $rootScope.$watch(function(scope) {
-    return scope.LDAPSynced;
-  }, function(LDAPSynced) {
-    if(LDAPSynced === true){
-      $rootScope.LDAPSynced = false;
-      loadGroups();
-    }
-  });
-
-}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
deleted file mode 100644
index c945644..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-.controller('MainCtrl',['$scope','$rootScope','$window','Auth', 'Alert', '$modal', 'Cluster', 'View', '$translate', '$http', 'Settings', 'Utility', '$q', function($scope, $rootScope, $window, Auth, Alert, $modal, Cluster, View, $translate, $http, Settings, Utility, $q) {
-  var $t = $translate.instant;
-  $scope.signOut = function() {
-    Auth.signout().finally(function() {
-      $window.location.pathname = Settings.siteRoot;
-    });
-  };
-
-  $scope.ambariVersion = null;
-  $rootScope.supports = {};
-  $rootScope.authDataLoad = $q.defer();
-
-  Utility.getUserPref('user-pref-' + Auth.getCurrentUser() + '-supports').then(function(data) {
-    $rootScope.supports = data.data ? data.data : {};
-  });
-
-  $http.get(Settings.baseUrl + '/users/' + Auth.getCurrentUser() + '/authorizations?fields=*')
-    .then(function(data) {
-      var auth = !!data.data && !!data.data.items ? data.data.items.map(function (a) {
-          return a.AuthorizationInfo.authorization_id;
-        }) : [],
-        canPersistData = auth.indexOf('CLUSTER.MANAGE_USER_PERSISTED_DATA') > -1;
-      $rootScope.authDataLoad.resolve(canPersistData);
-      if(auth.indexOf('AMBARI.RENAME_CLUSTER') == -1) {
-        $window.location = $rootScope.fromSiteRoot("/#/main/dashboard");
-      }
-    });
-
-  $scope.about = function() {
-   var ambariVersion = $scope.ambariVersion;
-  	var modalInstance = $modal.open({
-  		templateUrl:'views/modals/AboutModal.html',
-  		controller: ['$scope', function($scope) {
-  			$scope.ok = function() {
-  				modalInstance.close();
-  			};
-        $scope.ambariVersion = ambariVersion;
-  		}]
-  	});
-  };
-
-  $scope.currentUser = Auth.getCurrentUser();
-
-  $scope.cluster = null;
-  $scope.isLoaded = null;
-
-  function loadAmbariVersion() {
-    Cluster.getAmbariVersion().then(function(version){
-      $scope.ambariVersion = version;
-    });
-  }
-
-  function loadClusterData(){
-    Cluster.getStatus().then(function(cluster) {
-      $scope.cluster = cluster;
-      $scope.isLoaded = true;
-      if(cluster && cluster.Clusters.provisioning_state === 'INIT'){
-        setTimeout(loadClusterData, 1000);
-      }
-    }).catch(function(data) {
-      Alert.error($t('common.alerts.cannotLoadClusterStatus'), data.statusText);
-    });
-  }
-  loadClusterData();
-  loadAmbariVersion();
-
-  $scope.viewInstances = [];
-
-  $scope.updateInstances = function () {
-    View.getAllVisibleInstance().then(function(instances) {
-      $scope.viewInstances = instances.map(function(i) {
-        i.viewUrl = i.view_name + '/' + i.version + '/' + i.instance_name;
-        return i;
-      });
-    });
-  };
-
-  $scope.gotoViewsDashboard =function() {
-    window.location = Settings.siteRoot + '#/main/views';
-  };
-
-  $scope.$root.$on('instancesUpdate', function (event, data) {
-    $scope.updateInstances();
-  });
-
-  $scope.startInactiveTimeoutMonitoring = function(timeout) {
-    var TIME_OUT = timeout;
-    var active = true;
-    var lastActiveTime = Date.now();
-
-    var keepActive = function() {
-      if (active) {
-        lastActiveTime = Date.now();
-      }
-    };
-
-    $(window).bind('mousemove', keepActive);
-    $(window).bind('keypress', keepActive);
-    $(window).bind('click', keepActive);
-
-    var checkActiveness = function() {
-      var remainTime = TIME_OUT - (Date.now() - lastActiveTime);
-      if (remainTime < 0) {
-        active = false;
-        $(window).unbind('mousemove', keepActive);
-        $(window).unbind('keypress', keepActive);
-        $(window).unbind('click', keepActive);
-        clearInterval($rootScope.userActivityTimeoutInterval);
-        $scope.signOut();
-      } else if (remainTime < 60000 && !$rootScope.timeoutModal) {
-        $rootScope.timeoutModal = $modal.open({
-          templateUrl: 'views/modals/TimeoutWarning.html',
-          backdrop: false,
-          controller: ['$scope', 'Auth', function($scope, Auth) {
-            $scope.remainTime = 60;
-            $scope.title = $t('main.autoLogOut');
-            $scope.primaryText = $t('main.controls.remainLoggedIn');
-            $scope.secondaryText = $t('main.controls.logOut');
-            $scope.remain = function() {
-              $rootScope.timeoutModal.close();
-              delete $rootScope.timeoutModal;
-            };
-            $scope.logout = function() {
-              $rootScope.timeoutModal.close();
-              delete $rootScope.timeoutModal;
-              Auth.signout().finally(function() {
-                $window.location.pathname = Settings.siteRoot;
-              });
-            };
-            $scope.countDown = function() {
-              $scope.remainTime--;
-              $scope.$apply();
-              if ($scope.remainTime == 0) {
-                Auth.signout().finally(function() {
-                  $window.location.pathname = Settings.siteRoot;
-                });
-              }
-            };
-            setInterval($scope.countDown, 1000);
-          }]
-        });
-      }
-    };
-    $rootScope.userActivityTimeoutInterval = window.setInterval(checkActiveness, 1000);
-  };
-
-  // Send noop requests every 10 seconds just to keep backend session alive
-  $scope.startNoopPolling = function() {
-    $rootScope.noopPollingInterval = setInterval(Cluster.getAmbariTimeout, 10000);
-  };
-
-  if (!$rootScope.userActivityTimeoutInterval) {
-    Cluster.getAmbariTimeout().then(function(timeout) {
-      $rootScope.userTimeout = Number(timeout) * 1000;
-      if ($rootScope.userTimeout > 0)
-        $scope.startInactiveTimeoutMonitoring($rootScope.userTimeout);
-    });
-  }
-  if (!$rootScope.noopPollingInterval) {
-    $scope.startNoopPolling();
-  }
-  $scope.updateInstances();
-}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
index 09e3c28..542772e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
@@ -33,6 +33,15 @@ angular.module('ambariAdminConsole')
     display_name: ''
   };
   $scope.defaulfOSRepos = {}; // a copy of initial loaded repo info for "changed" check later
+  $scope.isGPLAccepted = false;
+
+  $scope.isGPLRepo = function (repository) {
+    return repository.Repositories.tags.indexOf('GPL') >= 0;
+  };
+
+  $scope.showRepo = function (repository) {
+    return $scope.isGPLAccepted || !$scope.isGPLRepo(repository);
+  };
 
   $scope.loadStackVersionInfo = function () {
     return Stack.getRepo($routeParams.versionId, $routeParams.stackName).then(function (response) {
@@ -67,6 +76,9 @@ angular.module('ambariAdminConsole')
       // load supported os type base on stack version
       $scope.afterStackVersionRead();
 
+      // Load GPL license accepted value
+      $scope.fetchGPLLicenseAccepted();
+
       // if user reach here from UI click, repo status should be cached
       // otherwise re-fetch repo status from cluster end point.
       $scope.repoStatus = Cluster.repoStatusCache[$scope.id];
@@ -85,6 +97,15 @@ angular.module('ambariAdminConsole')
   };
 
   /**
+   * Load GPL License Accepted value
+   */
+  $scope.fetchGPLLicenseAccepted = function () {
+    Stack.getGPLLicenseAccepted().then(function (data) {
+      $scope.isGPLAccepted = data === 'true';
+    })
+  };
+
+  /**
    * Load supported OS list
    */
   $scope.afterStackVersionRead = function () {
@@ -170,7 +191,11 @@ angular.module('ambariAdminConsole')
 
   $scope.updateRepoVersions = function () {
     var skip = $scope.skipValidation || $scope.useRedhatSatellite;
-    return Stack.validateBaseUrls(skip, $scope.osList, $scope.upgradeStack).then(function (invalidUrls) {
+    // Filter out repositories that are not shown in the UI
+    var osList = Object.assign([], $scope.osList).map(function(os) {
+      return Object.assign({}, os, {repositories: os.repositories.filter(function(repo) { return $scope.showRepo(repo); })});
+    });
+    return Stack.validateBaseUrls(skip, osList, $scope.upgradeStack).then(function (invalidUrls) {
       if (invalidUrls.length === 0) {
         Stack.updateRepo($scope.upgradeStack.stack_name, $scope.upgradeStack.stack_version, $scope.id, $scope.updateObj).then(function () {
           Alert.success($t('versions.alerts.versionEdited', {

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupCreateCtrl.js
new file mode 100644
index 0000000..a34033b
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupCreateCtrl.js
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('GroupCreateCtrl',
+['$scope', '$rootScope', 'Group', '$location', 'Alert', 'UnsavedDialog', '$translate', '$modalInstance', 'Cluster', 'RoleDetailsModal',
+function($scope, $rootScope, Group, $location, Alert, UnsavedDialog, $translate, $modalInstance, Cluster, RoleDetailsModal) {
+  var $t = $translate.instant;
+
+  $scope.form = {};
+  $scope.formData = {
+    groupName: '',
+    members: [],
+    role: ''
+  };
+  $scope.roleOptions = [];
+
+
+  function loadRoles() {
+    return Cluster.getRoleOptions().then(function (data) {
+      $scope.roleOptions = data;
+    });
+  }
+
+  function unsavedChangesCheck() {
+    if ($scope.form.groupCreateForm.$dirty) {
+      UnsavedDialog().then(function (action) {
+        switch (action) {
+          case 'save':
+            $scope.save();
+            break;
+          case 'discard':
+            $modalInstance.close('discard');
+            break;
+          case 'cancel':
+            break;
+        }
+      });
+    } else {
+      $modalInstance.close('discard');
+    }
+  }
+
+  function saveMembers(group, members) {
+    if (!members.length) {
+      return;
+    }
+    group.members = members.filter(function(item) {
+      return item.trim();
+    }).map(function(item) {
+      return item.trim();
+    });
+    group.saveMembers().catch(function(data) {
+      Alert.error($t('groups.alerts.cannotUpdateGroupMembers'), "<div class='break-word'>" + data.message + "</div>");
+    });
+  }
+
+  $scope.showHelpPage = function() {
+    Cluster.getRolesWithAuthorizations().then(function(roles) {
+      RoleDetailsModal.show(roles);
+    });
+  };
+
+  $scope.save = function () {
+    $scope.form.groupCreateForm.submitted = true;
+    if ($scope.form.groupCreateForm.$valid) {
+      var group = new Group($scope.formData.groupName);
+      group.save().then(function () {
+        saveMembers(group, $scope.formData.members);
+        saveRole();
+        $modalInstance.dismiss('created');
+        Alert.success($t('groups.alerts.groupCreated', {groupName: $scope.formData.groupName}));
+      })
+      .catch(function (data) {
+        Alert.error($t('groups.alerts.groupCreationError'), data.data.message);
+      });
+    }
+  };
+
+  function saveRole() {
+    if (!$scope.formData.role || $scope.formData.role === 'NONE') {
+      return;
+    }
+    Cluster.createPrivileges(
+      {
+        clusterId: $rootScope.cluster.Clusters.cluster_name
+      },
+      [{PrivilegeInfo: {
+        permission_name: $scope.formData.role,
+        principal_name: $scope.formData.groupName,
+        principal_type: 'GROUP'
+      }}]
+    )
+    .catch(function(data) {
+      Alert.error($t('common.alerts.cannotSavePermissions'), data.data.message);
+    });
+  }
+
+  $scope.cancel = function () {
+    unsavedChangesCheck();
+  };
+
+  loadRoles();
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupEditCtrl.js
new file mode 100644
index 0000000..8855317
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupEditCtrl.js
@@ -0,0 +1,248 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('GroupEditCtrl',
+['$scope', '$rootScope', 'Group', '$routeParams', 'Cluster', 'View', 'Alert', 'ConfirmationModal', '$location', '$translate', 'RoleDetailsModal',
+function($scope, $rootScope, Group, $routeParams, Cluster, View, Alert, ConfirmationModal, $location,  $translate, RoleDetailsModal) {
+  var $t = $translate.instant;
+  var nonRole = {
+    permission_name: 'NONE',
+    permission_label: $t('users.roles.none')
+  };
+
+  $scope.constants = {
+    group: $t('common.group'),
+    view: $t('common.view').toLowerCase(),
+    cluster: $t('common.cluster').toLowerCase()
+  };
+  $scope.editMode = false;
+  $scope.group = new Group($routeParams.id);
+  $scope.group.editingUsers = [];
+  $scope.groupMembers = [];
+  $scope.dataLoaded = false;
+  $scope.isMembersEditing = false;
+
+  $scope.$watch(function() {
+    return $scope.group.editingUsers;
+  }, function(newValue) {
+    if(newValue && !angular.equals(newValue, $scope.groupMembers)){
+      $scope.updateMembers();  
+    }
+  }, true);
+  
+  $scope.enableMembersEditing = function() {
+    $scope.isMembersEditing = true;
+    $scope.group.editingUsers = angular.copy($scope.groupMembers);
+  };
+  $scope.cancelUpdate = function() {
+    $scope.isMembersEditing = false;
+    $scope.group.editingUsers = '';
+  };
+  $scope.updateMembers = function() {
+    var newMembers = $scope.group.editingUsers.toString().split(',').filter(function(item) {
+      return item.trim();}
+    ).map(function(item) {
+        return item.trim()
+      }
+    );
+    $scope.group.members = newMembers;
+    $scope.group.saveMembers().catch(function(data) {
+        Alert.error($t('groups.alerts.cannotUpdateGroupMembers'), "<div class='break-word'>" + data.message + "</div>");
+      }).finally(function() {
+        loadGroup();
+      });
+    $scope.isMembersEditing = false;
+  };
+
+  $scope.deleteGroup = function(group) {
+    ConfirmationModal.show(
+      $t('common.delete', {
+        term: $t('common.group')
+      }),
+      $t('common.deleteConfirmation', {
+        instanceType: $t('common.group').toLowerCase(),
+        instanceName: '"' + group.group_name + '"'
+      })
+    ).then(function() {
+      Cluster.getPrivilegesForResource({
+        nameFilter : group.group_name,
+        typeFilter : {value: 'GROUP'}
+      }).then(function(data) {
+        var clusterPrivilegesIds = [];
+        var viewsPrivileges = [];
+        if (data.items && data.items.length) {
+          angular.forEach(data.items[0].privileges, function(privilege) {
+            if (privilege.PrivilegeInfo.principal_type === 'GROUP') {
+              if (privilege.PrivilegeInfo.type === 'VIEW') {
+                viewsPrivileges.push({
+                  id: privilege.PrivilegeInfo.privilege_id,
+                  view_name: privilege.PrivilegeInfo.view_name,
+                  version: privilege.PrivilegeInfo.version,
+                  instance_name: privilege.PrivilegeInfo.instance_name
+                });
+              } else {
+                clusterPrivilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+              }
+            }
+          });
+        }
+        group.destroy().then(function() {
+          $location.path('/userManagement?tab=groups');
+          if (clusterPrivilegesIds.length) {
+            Cluster.deleteMultiplePrivileges($rootScope.cluster.Clusters.cluster_name, clusterPrivilegesIds);
+          }
+          angular.forEach(viewsPrivileges, function(privilege) {
+            View.deletePrivilege(privilege);
+          });
+        });
+      });
+    });
+  };
+
+
+  $scope.removeViewPrivilege = function(name, privilege) {
+    var privilegeObject = {
+        id: privilege.privilege_id,
+        view_name: privilege.view_name,
+        version: privilege.version,
+        instance_name: name
+    };
+    View.deletePrivilege(privilegeObject).then(function() {
+      loadGroup();
+    });
+  };
+
+  $scope.showHelpPage = function() {
+    Cluster.getRolesWithAuthorizations().then(function(roles) {
+      RoleDetailsModal.show(roles);
+    });
+  };
+
+  $scope.updateRole = function () {
+    var clusterName = $rootScope.cluster.Clusters.cluster_name;
+    if ($scope.originalRole.permission_name !== $scope.currentRole.permission_name) {
+      if ($scope.currentRole.permission_name === 'NONE') {
+        deleteGroupRoles(clusterName, $scope.group).finally(loadGroup);
+      } else {
+        if ($scope.group.roles.length) {
+          deleteGroupRoles(clusterName, $scope.group, true).finally(function() {
+            addGroupRoles(clusterName, $scope.currentRole, $scope.group).finally(loadGroup);
+          });
+        } else {
+          addGroupRoles(clusterName, $scope.currentRole, $scope.group).finally(loadGroup);
+        }
+      }
+    }
+  };
+
+  function deleteGroupRoles(clusterName, group, ignoreAlert) {
+    return Cluster.deleteMultiplePrivileges(
+      clusterName,
+      group.roles.map(function(item) {
+        return item.privilege_id;
+      })
+    ).then(function () {
+      if (!ignoreAlert) {
+        Alert.success($t('users.alerts.roleChangedToNone', {
+          user_name: group.group_name
+        }));
+      }
+    }).catch(function (data) {
+      Alert.error($t('common.alerts.cannotSavePermissions'), data.data.message);
+    });
+  }
+
+  function addGroupRoles(clusterName, newRole, group) {
+    return Cluster.createPrivileges(
+      {
+        clusterId: clusterName
+      },
+      [{
+        PrivilegeInfo: {
+          permission_name: newRole.permission_name,
+          principal_name: group.group_name,
+          principal_type: 'GROUP'
+        }
+      }]
+    ).then(function () {
+      Alert.success($t('users.alerts.roleChanged', {
+        name: group.group_name,
+        role: newRole.permission_label
+      }));
+    }).catch(function (data) {
+      Alert.error($t('common.alerts.cannotSavePermissions'), data.data.message);
+    });
+  }
+
+  function parsePrivileges(rawPrivileges) {
+    var privileges = {
+      clusters: {},
+      views: {}
+    };
+    angular.forEach(rawPrivileges, function (privilege) {
+      privilege = privilege.PrivilegeInfo;
+      if (privilege.type === 'CLUSTER') {
+        // This is cluster
+        privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name] || [];
+        privileges.clusters[privilege.cluster_name].push(privilege.permission_label);
+      } else if (privilege.type === 'VIEW') {
+        privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || {
+          privileges: [],
+          version: privilege.version,
+          view_name: privilege.view_name,
+          privilege_id: privilege.privilege_id
+        };
+        if (privileges.views[privilege.instance_name].privileges.indexOf(privilege.permission_label) === -1) {
+          privileges.views[privilege.instance_name].privileges.push(privilege.permission_label);
+        }
+      }
+    });
+
+    $scope.privileges = privileges;
+    $scope.noClusterPriv = $.isEmptyObject(privileges.clusters);
+    $scope.noViewPriv = $.isEmptyObject(privileges.views);
+    $scope.hidePrivileges = $scope.noClusterPriv && $scope.noViewPriv;
+  }
+
+  function loadGroup() {
+    Group.get($routeParams.id).then(function(group) {
+      $scope.group = group;
+      parsePrivileges(group.privileges);
+      var clusterRole = $scope.group.roles[0];
+      $scope.currentRole = clusterRole || nonRole;
+      $scope.originalRole = clusterRole || nonRole;
+      $scope.groupMembers = group.members.map(function(item) {
+        return item.MemberInfo.user_name;
+      });
+      $scope.group.editingUsers = angular.copy($scope.groupMembers);
+    }).finally(function() {
+      $scope.dataLoaded = true;
+    });
+  }
+
+  function loadRoles() {
+    return Cluster.getRoleOptions().then(function(data) {
+      $scope.roleOptions = data;
+    });
+  }
+
+  loadRoles().finally(loadGroup);
+
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupsListCtrl.js
new file mode 100644
index 0000000..61b5282
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/GroupsListCtrl.js
@@ -0,0 +1,167 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('GroupsListCtrl',
+['$scope', 'Group', '$modal', 'ConfirmationModal', '$rootScope', '$translate', 'Settings', 'Cluster', 'View', 'Alert',
+function($scope, Group, $modal, ConfirmationModal, $rootScope, $translate, Settings, Cluster, View, Alert) {
+  var $t = $translate.instant;
+  $scope.constants = {
+    groups: $t('common.groups').toLowerCase()
+  };
+  $scope.minRowsToShowPagination = Settings.minRowsToShowPagination;
+  $scope.isLoading = false;
+  $scope.groups = [];
+
+  $scope.groupsPerPage = 10;
+  $scope.currentPage = 1;
+  $scope.totalGroups = 0;
+  $scope.filter = {
+    name: '',
+    type: null
+  };
+  $scope.maxVisiblePages=20;
+  $scope.tableInfo = {
+    total: 0,
+    showed: 0
+  };
+  $scope.isNotEmptyFilter = true;
+
+  $scope.pageChanged = function() {
+    loadGroups();
+  };
+  $scope.groupsPerPageChanges = function() {
+    loadGroups();
+  };
+
+  $scope.resetPagination = function() {
+    $scope.currentPage = 1;
+    loadGroups();
+  };
+
+  function loadGroups(){
+    $scope.isLoading = true;
+    Group.all({
+      currentPage: $scope.currentPage, 
+      groupsPerPage: $scope.groupsPerPage, 
+      searchString: $scope.filter.name,
+      group_type: $scope.filter.type.value
+    }).then(function(groups) {
+      $scope.isLoading = false;
+      $scope.totalGroups = groups.itemTotal;
+      $scope.groups = groups.map(Group.makeGroup);
+      $scope.tableInfo.total = groups.itemTotal;
+      $scope.tableInfo.showed = groups.length;
+    })
+    .catch(function(data) {
+      Alert.error($t('groups.alerts.getGroupsListError'), data.data.message);
+    });
+  }
+
+  $scope.typeFilterOptions = [{ label: $t('common.all'), value: '*'}]
+    .concat(Object.keys(Group.getTypes()).map(function(key) {
+      return {
+        label: $t(Group.getTypes()[key].LABEL_KEY),
+        value: Group.getTypes()[key].VALUE
+      };
+  }));
+  $scope.filter.type = $scope.typeFilterOptions[0];
+
+  $scope.clearFilters = function () {
+    $scope.filter.name = '';
+    $scope.filter.type = $scope.typeFilterOptions[0];
+    $scope.resetPagination();
+  };
+  
+  loadGroups();
+
+  $scope.$watch(
+    function (scope) {
+      return Boolean(scope.filter.name || (scope.filter.type && scope.filter.type.value !== '*'));
+    },
+    function (newValue, oldValue, scope) {
+      scope.isNotEmptyFilter = newValue;
+    }
+  );
+
+  $rootScope.$watch(function(scope) {
+    return scope.LDAPSynced;
+  }, function(LDAPSynced) {
+    if(LDAPSynced === true){
+      $rootScope.LDAPSynced = false;
+      loadGroups();
+    }
+  });
+
+  $scope.createGroup = function () {
+    var modalInstance = $modal.open({
+      templateUrl: 'views/userManagement/modals/groupCreate.html',
+      controller: 'GroupCreateCtrl',
+      backdrop: 'static'
+    });
+
+    modalInstance.result.catch(loadGroups);
+  };
+
+  $scope.deleteGroup = function(group) {
+    ConfirmationModal.show(
+      $t('common.delete', {
+        term: $t('common.group')
+      }),
+      $t('common.deleteConfirmation', {
+        instanceType: $t('common.group').toLowerCase(),
+        instanceName: '"' + group.group_name + '"'
+      })
+    ).then(function() {
+      Cluster.getPrivilegesForResource({
+        nameFilter : group.group_name,
+        typeFilter : {value: 'GROUP'}
+      }).then(function(data) {
+        var clusterPrivilegesIds = [];
+        var viewsPrivileges = [];
+        if (data.items && data.items.length) {
+          angular.forEach(data.items[0].privileges, function(privilege) {
+            if (privilege.PrivilegeInfo.principal_type === 'GROUP') {
+              if (privilege.PrivilegeInfo.type === 'VIEW') {
+                viewsPrivileges.push({
+                  id: privilege.PrivilegeInfo.privilege_id,
+                  view_name: privilege.PrivilegeInfo.view_name,
+                  version: privilege.PrivilegeInfo.version,
+                  instance_name: privilege.PrivilegeInfo.instance_name
+                });
+              } else {
+                clusterPrivilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+              }
+            }
+          });
+        }
+        group.destroy().then(function() {
+          if (clusterPrivilegesIds.length) {
+            Cluster.deleteMultiplePrivileges($rootScope.cluster.Clusters.cluster_name, clusterPrivilegesIds);
+          }
+          angular.forEach(viewsPrivileges, function(privilege) {
+            View.deletePrivilege(privilege);
+          });
+          loadGroups();
+        });
+      });
+    });
+  };
+
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserCreateCtrl.js
new file mode 100644
index 0000000..3b29b90
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserCreateCtrl.js
@@ -0,0 +1,113 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('UserCreateCtrl',
+['$scope', '$rootScope', 'User', '$location', 'Alert', 'UnsavedDialog', '$translate', 'Cluster', '$modalInstance', 'RoleDetailsModal',
+function($scope, $rootScope, User, $location, Alert, UnsavedDialog, $translate, Cluster, $modalInstance, RoleDetailsModal) {
+  var $t = $translate.instant;
+
+  $scope.form = {};
+  $scope.formData = {
+    userName: '',
+    password: '',
+    confirmPassword: '',
+    role: '',
+    isAdmin: false,
+    isActive: true
+  };
+  $scope.roleOptions = [];
+
+  function loadRoles() {
+    return Cluster.getRoleOptions().then(function (data) {
+      $scope.roleOptions = data;
+    });
+  }
+
+  function unsavedChangesCheck() {
+    if ($scope.form.userCreateForm.$dirty) {
+      UnsavedDialog().then(function (action) {
+        switch (action) {
+          case 'save':
+            $scope.save();
+            break;
+          case 'discard':
+            $modalInstance.close('discard');
+            break;
+          case 'cancel':
+            break;
+        }
+      });
+    } else {
+      $modalInstance.close('discard');
+    }
+  }
+
+  $scope.showHelpPage = function() {
+    Cluster.getRolesWithAuthorizations().then(function(roles) {
+      RoleDetailsModal.show(roles);
+    });
+  };
+
+  $scope.save = function () {
+    $scope.form.userCreateForm.submitted = true;
+    if ($scope.form.userCreateForm.$valid) {
+      User.create({
+        'Users/user_name': $scope.formData.userName,
+        'Users/password': $scope.formData.password,
+        'Users/active': Boolean($scope.formData.isActive),
+        'Users/admin': Boolean($scope.formData.isAdmin)
+      }).then(function () {
+        saveRole();
+        $modalInstance.dismiss('created');
+        Alert.success($t('users.alerts.userCreated', {
+          userName: $scope.formData.userName,
+          encUserName: encodeURIComponent($scope.formData.userName)
+        }));
+      }).catch(function (data) {
+        Alert.error($t('users.alerts.userCreationError'), data.data.message);
+      });
+    }
+  };
+
+  function saveRole() {
+    if (!$scope.formData.role || $scope.formData.role === 'NONE') {
+      return;
+    }
+    Cluster.createPrivileges(
+      {
+        clusterId: $rootScope.cluster.Clusters.cluster_name
+      },
+      [{PrivilegeInfo: {
+        permission_name: $scope.formData.role,
+        principal_name: $scope.formData.userName,
+        principal_type: 'USER'
+      }}]
+    )
+    .catch(function(data) {
+      Alert.error($t('common.alerts.cannotSavePermissions'), data.data.message);
+    });
+  }
+
+  $scope.cancel = function () {
+    unsavedChangesCheck();
+  };
+
+  loadRoles();
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserEditCtrl.js
new file mode 100644
index 0000000..a3c96cd
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserEditCtrl.js
@@ -0,0 +1,364 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('UserEditCtrl',
+['$scope', '$rootScope', '$routeParams', 'Cluster', 'User', 'View', '$modal', '$location', 'ConfirmationModal', 'Alert', 'Auth', 'getDifference', 'Group', '$q', 'UserConstants', '$translate', 'RoleDetailsModal',
+function($scope, $rootScope, $routeParams, Cluster, User, View, $modal, $location, ConfirmationModal, Alert, Auth, getDifference, Group, $q, UserConstants, $translate, RoleDetailsModal) {
+
+  var $t = $translate.instant;
+  var nonRole = {
+    permission_name: 'NONE',
+    permission_label: $t('users.roles.none')
+  };
+
+  $scope.constants = {
+    user: $t('common.user'),
+    status: $t('users.status'),
+    admin: $t('users.admin'),
+    password: $t('users.password'),
+    view: $t('common.view').toLowerCase(),
+    cluster: $t('common.cluster').toLowerCase()
+  };
+
+  $scope.user = null;
+  $scope.isCurrentUser = true;
+  $scope.dataLoaded = false;
+  $scope.isGroupEditing = false;
+
+  $scope.enableGroupEditing = function () {
+    $scope.isGroupEditing = true;
+    $scope.editingGroupsList = angular.copy($scope.user.groups);
+  };
+
+  $scope.$watch(function () {
+    return $scope.editingGroupsList;
+  }, function (newValue) {
+    if (newValue) {
+      if (!angular.equals(newValue, $scope.user.groups)) {
+        $scope.updateGroups();
+      }
+    }
+  }, true);
+
+  $scope.showHelpPage = function() {
+    Cluster.getRolesWithAuthorizations().then(function(roles) {
+      RoleDetailsModal.show(roles);
+    });
+  };
+
+  $scope.updateRole = function () {
+    var clusterName = $rootScope.cluster.Clusters.cluster_name;
+    if ($scope.originalRole.permission_name !== $scope.currentRole.permission_name) {
+      if ($scope.currentRole.permission_name === 'NONE') {
+        deleteUserRoles(clusterName, $scope.user).finally(loadUserInfo);
+      } else {
+        if ($scope.user.roles.length) {
+          deleteUserRoles(clusterName, $scope.user, true).finally(function() {
+            addUserRoles(clusterName, $scope.currentRole, $scope.user).finally(loadUserInfo);
+          });
+        } else {
+          addUserRoles(clusterName, $scope.currentRole, $scope.user).finally(loadUserInfo);
+        }
+      }
+    }
+  };
+
+  $scope.updateGroups = function () {
+    var groups = $scope.editingGroupsList.filter(function (item) {
+      return item.trim();
+    }).map(function (item) {
+      return item.trim();
+    });
+    var diff = getDifference($scope.user.groups, groups);
+    var promises = [];
+    // Remove user from groups
+    angular.forEach(diff.del, function (groupName) {
+      promises.push(Group.removeMemberFromGroup(groupName, $scope.user.user_name).catch(function (data) {
+        Alert.error($t('users.alerts.removeUserError'), data.data.message);
+      }));
+    });
+    // Add user to groups
+    angular.forEach(diff.add, function (groupName) {
+      promises.push(Group.addMemberToGroup(groupName, $scope.user.user_name).catch(function (data) {
+        Alert.error($t('users.alerts.cannotAddUser'), data.data.message);
+      }));
+    });
+    $q.all(promises).then(function () {
+      loadUserInfo();
+    });
+    $scope.isGroupEditing = false;
+  };
+
+  $scope.getUserMembership = function (userType) {
+    if (userType) {
+      return $t(UserConstants.TYPES[userType].LABEL_KEY) + " " + $t('users.groupMembership');
+    }
+  };
+
+  $scope.cancelUpdate = function () {
+    $scope.isGroupEditing = false;
+    $scope.editingGroupsList = '';
+  };
+
+  $scope.openChangePwdDialog = function () {
+    var modalInstance = $modal.open({
+      templateUrl: 'views/userManagement/modals/changePassword.html',
+      resolve: {
+        userName: function () {
+          return $scope.user.user_name;
+        }
+      },
+      controller: ['$scope', 'userName', function ($scope, userName) {
+        $scope.passwordData = {
+          password: '',
+          currentUserPassword: ''
+        };
+
+        $scope.form = {};
+        $scope.userName = userName;
+
+        $scope.ok = function () {
+          $scope.form.passwordChangeForm.submitted = true;
+          if ($scope.form.passwordChangeForm.$valid) {
+            modalInstance.close({
+              password: $scope.passwordData.password,
+              currentUserPassword: $scope.passwordData.currentUserPassword
+            });
+          }
+        };
+        $scope.cancel = function () {
+          modalInstance.dismiss('cancel');
+        };
+      }]
+    });
+
+    modalInstance.result.then(function (data) {
+      User.setPassword($scope.user, data.password, data.currentUserPassword).then(function () {
+        Alert.success($t('users.alerts.passwordChanged'));
+      }).catch(function (data) {
+        Alert.error($t('users.alerts.cannotChangePassword'), data.data.message);
+      });
+    });
+  };
+
+  $scope.toggleUserActive = function () {
+    if (!$scope.isCurrentUser) {
+      var newStatusKey = $scope.user.active ? 'inactive' : 'active';
+      ConfirmationModal.show(
+        $t('users.changeStatusConfirmation.title'),
+        $t('users.changeStatusConfirmation.message', {
+          userName: $scope.user.user_name,
+          status: $t('users.' + newStatusKey).toLowerCase()
+        })
+      ).then(function () {
+        User.setActive($scope.user.user_name, $scope.user.active)
+        .catch(function (data) {
+          Alert.error($t('common.alerts.cannotUpdateStatus'), data.data.message);
+          $scope.user.active = !$scope.user.active;
+        });
+      })
+      .catch(function () {
+        $scope.user.active = !$scope.user.active;
+      });
+    }
+  };
+
+  $scope.toggleUserAdmin = function () {
+    if (!$scope.isCurrentUser) {
+      var action = $scope.user.admin ?
+        $t('users.changePrivilegeConfirmation.revoke') : $t('users.changePrivilegeConfirmation.grant');
+      ConfirmationModal.show(
+        $t('users.changePrivilegeConfirmation.title'),
+        $t('users.changePrivilegeConfirmation.message', {
+          action: action,
+          userName: $scope.user.user_name
+        })
+      ).then(function () {
+        User.setAdmin($scope.user.user_name, $scope.user.admin)
+        .then(function () {
+          loadUserInfo();
+        })
+        .catch(function (data) {
+          Alert.error($t('common.alerts.cannotUpdateAdminStatus'), data.data.message);
+          $scope.user.admin = !$scope.user.admin;
+        });
+      })
+      .catch(function () {
+        $scope.user.admin = !$scope.user.admin;
+      });
+    }
+  };
+
+  $scope.removeViewPrivilege = function (name, privilege) {
+    var privilegeObject = {
+      id: privilege.privilege_id,
+      view_name: privilege.view_name,
+      version: privilege.version,
+      instance_name: name
+    };
+    View.deletePrivilege(privilegeObject).then(function () {
+      loadUserInfo();
+    });
+  };
+
+  $scope.deleteUser = function () {
+    ConfirmationModal.show(
+      $t('common.delete', {
+        term: $t('common.user')
+      }),
+      $t('common.deleteConfirmation', {
+        instanceType: $t('common.user').toLowerCase(),
+        instanceName: '"' + $scope.user.user_name + '"'
+      })
+    ).then(function () {
+      Cluster.getPrivilegesForResource({
+        nameFilter: $scope.user.user_name,
+        typeFilter: {value: 'USER'}
+      }).then(function (data) {
+        var clusterPrivilegesIds = [];
+        var viewsPrivileges = [];
+        if (data.items && data.items.length) {
+          angular.forEach(data.items[0].privileges, function (privilege) {
+            if (privilege.PrivilegeInfo.principal_type === 'USER') {
+              if (privilege.PrivilegeInfo.type === 'VIEW') {
+                viewsPrivileges.push({
+                  id: privilege.PrivilegeInfo.privilege_id,
+                  view_name: privilege.PrivilegeInfo.view_name,
+                  version: privilege.PrivilegeInfo.version,
+                  instance_name: privilege.PrivilegeInfo.instance_name
+                });
+              } else {
+                clusterPrivilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+              }
+            }
+          });
+        }
+        User.delete($scope.user.user_name).then(function () {
+          $location.path('/userManagement?tab=users');
+          if (clusterPrivilegesIds.length) {
+            Cluster.deleteMultiplePrivileges($rootScope.cluster.Clusters.cluster_name, clusterPrivilegesIds);
+          }
+          angular.forEach(viewsPrivileges, function (privilege) {
+            View.deletePrivilege(privilege);
+          });
+        });
+      });
+    });
+  };
+
+  function deleteUserRoles(clusterName, user, ignoreAlert) {
+    return Cluster.deleteMultiplePrivileges(
+      clusterName,
+      user.roles.map(function(item) {
+        return item.privilege_id;
+      })
+    ).then(function () {
+      if (!ignoreAlert) {
+        Alert.success($t('users.alerts.roleChangedToNone', {
+          user_name: user.user_name
+        }));
+      }
+    }).catch(function (data) {
+      Alert.error($t('common.alerts.cannotSavePermissions'), data.data.message);
+    });
+  }
+
+  function addUserRoles(clusterName, newRole, user) {
+    return Cluster.createPrivileges(
+      {
+        clusterId: clusterName
+      },
+      [{
+        PrivilegeInfo: {
+          permission_name: newRole.permission_name,
+          principal_name: user.user_name,
+          principal_type: 'USER'
+        }
+      }]
+    ).then(function () {
+      Alert.success($t('users.alerts.roleChanged', {
+        name: user.user_name,
+        role: newRole.permission_label
+      }));
+    }).catch(function (data) {
+      Alert.error($t('common.alerts.cannotSavePermissions'), data.data.message);
+    });
+  }
+
+  function loadUserInfo() {
+    return User.getWithRoles($routeParams.id).then(function (data) {
+      $scope.user = User.makeUser(data.data).Users;
+      $scope.isCurrentUser = $scope.user.user_name === Auth.getCurrentUser();
+      $scope.editingGroupsList = angular.copy($scope.user.groups);
+      parsePrivileges(data.data.privileges);
+      var clusterRole = $scope.user.roles[0];
+      $scope.currentRole = clusterRole || nonRole;
+      $scope.originalRole = clusterRole || nonRole;
+      $scope.dataLoaded = true;
+    });
+  }
+
+  function parsePrivileges(rawPrivileges) {
+    var privileges = {
+      clusters: {},
+      views: {}
+    };
+    angular.forEach(rawPrivileges, function (privilege) {
+      privilege = privilege.PrivilegeInfo;
+      if (privilege.type === 'CLUSTER') {
+        // This is cluster
+        if (privileges.clusters[privilege.cluster_name]) {
+          var preIndex = Cluster.orderedRoles.indexOf(privileges.clusters[privilege.cluster_name].permission_name);
+          var curIndex = Cluster.orderedRoles.indexOf(privilege.permission_name);
+          // set more powerful role
+          if (curIndex < preIndex) {
+            privileges.clusters[privilege.cluster_name] = privilege;
+          }
+        } else {
+          privileges.clusters[privilege.cluster_name] = privilege;
+        }
+      } else if (privilege.type === 'VIEW') {
+        privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || {
+          privileges: [],
+          version: privilege.version,
+          view_name: privilege.view_name,
+          privilege_id: privilege.privilege_id
+        };
+        if (privileges.views[privilege.instance_name].privileges.indexOf(privilege.permission_label) === -1) {
+          privileges.views[privilege.instance_name].privileges.push(privilege.permission_label);
+        }
+      }
+    });
+
+    $scope.privilegesView = privileges;
+    $scope.noClusterPriv = $.isEmptyObject(privileges.clusters);
+    $scope.noViewPriv = $.isEmptyObject(privileges.views);
+    $scope.hidePrivileges = $scope.noClusterPriv && $scope.noViewPriv;
+  }
+
+  function loadRoles() {
+    return Cluster.getRoleOptions().then(function (data) {
+      $scope.roleOptions = data;
+    });
+  }
+
+  loadRoles().finally(loadUserInfo);
+
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserManagementCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserManagementCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserManagementCtrl.js
new file mode 100644
index 0000000..cb25606
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UserManagementCtrl.js
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('UserManagementCtrl', ['$scope', '$routeParams', function($scope, $routeParams) {
+  $scope.activeTab = $routeParams.tab === 'groups' ? 'GROUPS' : 'USERS';
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UsersListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UsersListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UsersListCtrl.js
new file mode 100644
index 0000000..00bf9c3
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/userManagement/UsersListCtrl.js
@@ -0,0 +1,177 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('UsersListCtrl',
+['$scope', 'User', '$modal', '$rootScope', 'UserConstants', '$translate', 'Cluster', 'View', 'ConfirmationModal', 'Settings',
+function($scope, User, $modal, $rootScope, UserConstants, $translate, Cluster, View, ConfirmationModal, Settings) {
+  var $t = $translate.instant;
+  $scope.constants = {
+    admin: $t('users.ambariAdmin'),
+    users: $t('common.users').toLowerCase()
+  };
+  $scope.minRowsToShowPagination = Settings.minRowsToShowPagination;
+  $scope.isLoading = false;
+  $scope.users = [];
+  $scope.usersPerPage = 10;
+  $scope.currentPage = 1;
+  $scope.totalUsers = 0;
+  $scope.filters = {
+    name: '',
+    status: null,
+    type: null
+  };
+  $scope.maxVisiblePages = 20;
+  $scope.tableInfo = {
+    total: 0,
+    showed: 0
+  };
+  $scope.isNotEmptyFilter = true;
+
+  function loadUsers() {
+    $scope.isLoading = true;
+    User.list({
+      currentPage: $scope.currentPage,
+      usersPerPage: $scope.usersPerPage,
+      searchString: $scope.filters.name,
+      user_type: $scope.filters.type.value,
+      active: $scope.filters.status.value
+    }).then(function (data) {
+      $scope.totalUsers = data.data.itemTotal;
+      $scope.users = data.data.items.map(User.makeUser);
+      $scope.tableInfo.showed = data.data.items.length;
+      $scope.tableInfo.total = data.data.itemTotal;
+    }).finally(function () {
+      $scope.isLoading = false;
+    });
+  }
+
+  $scope.pageChanged = function () {
+    loadUsers();
+  };
+  $scope.usersPerPageChanges = function () {
+    $scope.resetPagination();
+  };
+
+  $scope.resetPagination = function () {
+    $scope.currentPage = 1;
+    loadUsers();
+  };
+
+  $scope.activeFilterOptions = [
+    {label: $t('common.all'), value: '*'},
+    {label: $t('users.active'), value: true},
+    {label: $t('users.inactive'), value: false}
+  ];
+  $scope.filters.status = $scope.activeFilterOptions[0];
+
+  $scope.typeFilterOptions = [{label: $t('common.all'), value: '*'}]
+    .concat(Object.keys(UserConstants.TYPES).map(function (key) {
+      return {
+        label: $t(UserConstants.TYPES[key].LABEL_KEY),
+        value: UserConstants.TYPES[key].VALUE
+      };
+    }));
+
+  $scope.filters.type = $scope.typeFilterOptions[0];
+
+  $scope.clearFilters = function () {
+    $scope.filters.name = '';
+    $scope.filters.type = $scope.typeFilterOptions[0];
+    $scope.filters.status = $scope.activeFilterOptions[0];
+    $scope.resetPagination();
+  };
+
+  $scope.$watch(
+    function (scope) {
+      return Boolean(scope.filters.name || (scope.filters.status && scope.filters.status.value !== '*')
+        || (scope.filters.type && scope.filters.type.value !== '*'));
+    },
+    function (newValue, oldValue, scope) {
+      scope.isNotEmptyFilter = newValue;
+    }
+  );
+
+  $rootScope.$watch(function (scope) {
+    return scope.LDAPSynced;
+  }, function (LDAPSynced) {
+    if (LDAPSynced === true) {
+      $rootScope.LDAPSynced = false;
+      loadUsers();
+    }
+  });
+
+  $scope.createUser = function () {
+    var modalInstance = $modal.open({
+      templateUrl: 'views/userManagement/modals/userCreate.html',
+      controller: 'UserCreateCtrl',
+      backdrop: 'static'
+    });
+
+    modalInstance.result.finally(loadUsers);
+  };
+
+  $scope.deleteUser = function (user) {
+    ConfirmationModal.show(
+      $t('common.delete', {
+        term: $t('common.user')
+      }),
+      $t('common.deleteConfirmation', {
+        instanceType: $t('common.user').toLowerCase(),
+        instanceName: '"' + user.user_name + '"'
+      })
+    ).then(function () {
+      Cluster.getPrivilegesForResource({
+        nameFilter: user.user_name,
+        typeFilter: {value: 'USER'}
+      }).then(function (data) {
+        var clusterPrivilegesIds = [];
+        var viewsPrivileges = [];
+        if (data.items && data.items.length) {
+          angular.forEach(data.items[0].privileges, function (privilege) {
+            if (privilege.PrivilegeInfo.principal_type === 'USER') {
+              if (privilege.PrivilegeInfo.type === 'VIEW') {
+                viewsPrivileges.push({
+                  id: privilege.PrivilegeInfo.privilege_id,
+                  view_name: privilege.PrivilegeInfo.view_name,
+                  version: privilege.PrivilegeInfo.version,
+                  instance_name: privilege.PrivilegeInfo.instance_name
+                });
+              } else {
+                clusterPrivilegesIds.push(privilege.PrivilegeInfo.privilege_id);
+              }
+            }
+          });
+        }
+        User.delete(user.user_name).then(function () {
+          if (clusterPrivilegesIds.length) {
+            Cluster.deleteMultiplePrivileges($rootScope.cluster.Clusters.cluster_name, clusterPrivilegesIds);
+          }
+          angular.forEach(viewsPrivileges, function (privilege) {
+            View.deletePrivilege(privilege);
+          });
+          loadUsers();
+        });
+      });
+    });
+  };
+
+  loadUsers();
+
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
deleted file mode 100644
index bcb7bfc..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-.controller('UsersCreateCtrl',['$scope', '$routeParams', 'User', '$location', 'Alert', 'UnsavedDialog', '$translate', function($scope, $routeParams, User, $location, Alert, UnsavedDialog, $translate) {
-  var $t = $translate.instant;
-  $scope.user = {
-    active: true
-  };
-  var targetUrl = '/users';
-
-  $scope.createUser = function() {
-    $scope.form.submitted = true;
-    if ($scope.form.$valid){
-      User.create({
-        'Users/user_name': $scope.user.user_name,
-        'Users/password': $scope.user.password,
-        'Users/active': !!$scope.user.active,
-        'Users/admin': !!$scope.user.admin
-      }).then(function() {
-        Alert.success($t('users.alerts.userCreated', {
-          userName: $scope.user.user_name,
-          encUserName: encodeURIComponent($scope.user.user_name)
-        }));
-        $scope.form.$setPristine();
-        $location.path(targetUrl);
-      }).catch(function(data) {
-        Alert.error($t('users.alerts.userCreationError'), data.data.message);
-      });
-    }
-  };
-
-  $scope.cancel = function() {
-    $scope.form.$setPristine();
-    $location.path('/users');
-  };
-
-  $scope.$on('$locationChangeStart', function(event, __targetUrl) {
-        
-    if( $scope.form.$dirty ){
-      UnsavedDialog().then(function(action) {
-        targetUrl = __targetUrl.split('#').pop();
-        switch(action){
-          case 'save':
-            $scope.createUser();
-            break;
-          case 'discard':
-            $scope.form.$setPristine();
-            $location.path(targetUrl);
-            break;
-          case 'cancel':
-          targetUrl = '/users';
-            break;
-        }
-      });
-      event.preventDefault();
-    }
-  });
-}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
deleted file mode 100644
index 8146163..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-  .controller('UsersListCtrl',['$scope', 'User', '$modal', '$rootScope', 'UserConstants', '$translate', 'Settings', function($scope, User, $modal, $rootScope, UserConstants, $translate, Settings) {
-  var $t = $translate.instant;
-  $scope.constants = {
-    admin: $t('users.ambariAdmin'),
-    users: $t('common.users').toLowerCase()
-  };
-  $scope.isLoading = false;
-  $scope.users = [];
-  $scope.usersPerPage = 10;
-  $scope.currentPage = 1;
-  $scope.totalUsers = 1;
-  $scope.currentNameFilter = '';
-  $scope.maxVisiblePages=20;
-  $scope.tableInfo = {
-    total: 0,
-    showed: 0
-  };
-  $scope.isNotEmptyFilter = true;
-
-  $scope.pageChanged = function() {
-    $scope.loadUsers();
-  };
-  $scope.usersPerPageChanges = function() {
-    $scope.resetPagination();
-  };
-
-  $scope.loadUsers = function(){
-    $scope.isLoading = true;
-    User.list({
-      currentPage: $scope.currentPage,
-      usersPerPage: $scope.usersPerPage,
-      searchString: $scope.currentNameFilter,
-      user_type: $scope.currentTypeFilter.value,
-      active: $scope.currentActiveFilter.value,
-      admin: $scope.adminFilter
-    }).then(function(data) {
-      $scope.isLoading = false;
-      $scope.totalUsers = data.data.itemTotal;
-      $scope.users = data.data.items.map(User.makeUser);
-      $scope.tableInfo.showed = data.data.items.length;
-      $scope.tableInfo.total = data.data.itemTotal;
-    });
-  };
-
-  $scope.resetPagination = function() {
-    $scope.currentPage = 1;
-    $scope.loadUsers();
-  };
-
-  $scope.activeFilterOptions = [
-    {label: $t('common.all'), value: '*'},
-    {label: $t('users.active'), value: true},
-    {label: $t('users.inactive'), value:false}
-  ];
-  $scope.currentActiveFilter = $scope.activeFilterOptions[0];
-
-  $scope.typeFilterOptions = [{ label: $t('common.all'), value: '*'}]
-    .concat(Object.keys(UserConstants.TYPES).map(function(key) {
-      return {
-        label: $t(UserConstants.TYPES[key].LABEL_KEY),
-        value: UserConstants.TYPES[key].VALUE
-      };
-    }));
-
-  $scope.currentTypeFilter = $scope.typeFilterOptions[0];
-
-  $scope.adminFilter = false;
-  $scope.toggleAdminFilter = function() {
-    $scope.adminFilter = !$scope.adminFilter;
-    $scope.resetPagination();
-    $scope.loadUsers();
-  };
-
-  $scope.clearFilters = function () {
-    $scope.currentNameFilter = '';
-    $scope.currentTypeFilter = $scope.typeFilterOptions[0];
-    $scope.currentActiveFilter = $scope.activeFilterOptions[0];
-    $scope.adminFilter = false;
-    $scope.resetPagination();
-  };
-
-  $scope.loadUsers();
-
-  $scope.$watch(
-    function (scope) {
-      return Boolean(scope.currentNameFilter || (scope.currentActiveFilter && scope.currentActiveFilter.value !== '*')
-        || (scope.currentTypeFilter && scope.currentTypeFilter.value !== '*') || $scope.adminFilter);
-    },
-    function (newValue, oldValue, scope) {
-      scope.isNotEmptyFilter = newValue;
-    }
-  );
-
-  $rootScope.$watch(function(scope) {
-    return scope.LDAPSynced;
-  }, function(LDAPSynced) {
-    if(LDAPSynced === true){
-      $rootScope.LDAPSynced = false;
-      $scope.loadUsers();
-    }
-  });
-}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e83bf1bd/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
deleted file mode 100644
index 200872e..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
+++ /dev/null
@@ -1,290 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-.controller('UsersShowCtrl', ['$scope', '$routeParams', 'Cluster', 'User', 'View', '$modal', '$location', 'ConfirmationModal', 'Alert', 'Auth', 'getDifference', 'Group', '$q', 'UserConstants', '$translate', function($scope, $routeParams, Cluster, User, View, $modal, $location, ConfirmationModal, Alert, Auth, getDifference, Group, $q, UserConstants, $translate) {
-
-  var $t = $translate.instant;
-
-  $scope.constants = {
-    user: $t('common.user'),
-    status: $t('users.status'),
-    admin: $t('users.admin'),
-    password: $t('users.password'),
-    view: $t('common.view').toLowerCase(),
-    cluster: $t('common.cluster').toLowerCase()
-  };
-
-  function loadUserInfo(){
-    User.get($routeParams.id).then(function(data) {
-      $scope.user = User.makeUser(data).Users;
-      $scope.isCurrentUser = $scope.user.user_name === Auth.getCurrentUser();
-      $scope.editingGroupsList = angular.copy($scope.user.groups);
-    });
-  }
-
-  loadUserInfo();
-  $scope.user;
-  $scope.isCurrentUser = true;
-  $scope.dataLoaded = false;
-
-  $scope.isGroupEditing = false;
-  $scope.enableGroupEditing = function() {
-    $scope.isGroupEditing = true;
-    $scope.editingGroupsList = angular.copy($scope.user.groups);
-  };
-
-  $scope.$watch(function() {
-    return $scope.editingGroupsList;
-  }, function(newValue) {
-    if(newValue){
-      if( !angular.equals(newValue, $scope.user.groups) ){
-        $scope.updateGroups();
-      }
-    }
-  }, true);
-
-  $scope.updateGroups = function() {
-    var groups = $scope.editingGroupsList.toString().split(',').filter(function(item) {return item.trim();}).map(function(item) {return item.trim()});
-    var diff = getDifference($scope.user.groups, groups);
-    var promises = [];
-    // Remove user from groups
-    angular.forEach(diff.del, function(groupName) {
-      promises.push(Group.removeMemberFromGroup(groupName, $scope.user.user_name).catch(function(data) {
-        Alert.error($t('users.alerts.removeUserError'), data.data.message);
-      }));
-    });
-    // Add user to groups
-    angular.forEach(diff.add, function(groupName) {
-      promises.push(Group.addMemberToGroup(groupName, $scope.user.user_name).catch(function(data) {
-        Alert.error($t('users.alerts.cannotAddUser'), data.data.message);
-      }));
-    });
-    $q.all(promises).then(function() {
-      loadUserInfo();
-    });
-    $scope.isGroupEditing = false;
-  };
-
-  $scope.getUserMembership = function(userType) {
-    if(userType) {
-	return $t(UserConstants.TYPES[userType].LABEL_KEY) + " " + $t('users.groupMembership');
-    }
-  };
-
-  $scope.cancelUpdate = function() {
-    $scope.isGroupEditing = false;
-    $scope.editingGroupsList = '';
-  };
-
-  $scope.openChangePwdDialog = function() {
-    var modalInstance = $modal.open({
-      templateUrl: 'views/users/modals/changePassword.html',
-      resolve: {
-        userName: function() {
-          return $scope.user.user_name;
-        }
-      },
-      controller: ['$scope', 'userName', function($scope, userName) {
-        $scope.passwordData = {
-          password: '',
-          currentUserPassword: ''
-        };
-
-        $scope.form = {};
-        $scope.userName = userName;
-
-        $scope.ok = function() {
-          $scope.form.passwordChangeForm.submitted = true;
-          if($scope.form.passwordChangeForm.$valid){
-
-            modalInstance.close({
-              password: $scope.passwordData.password, 
-              currentUserPassword: $scope.passwordData.currentUserPassword
-            });
-          }
-        };
-        $scope.cancel = function() {
-          modalInstance.dismiss('cancel');
-        };
-      }]
-    });
-
-    modalInstance.result.then(function(data) {
-      User.setPassword($scope.user, data.password, data.currentUserPassword).then(function() {
-        Alert.success($t('users.alerts.passwordChanged'));
-      }).catch(function(data) {
-        Alert.error($t('users.alerts.cannotChangePassword'), data.data.message);
-      });
-    }); 
-  };
-
-  $scope.toggleUserActive = function() {
-    if(!$scope.isCurrentUser){
-      var newStatusKey = $scope.user.active ? 'inactive' : 'active',
-        newStatus = $t('users.' + newStatusKey).toLowerCase();
-      ConfirmationModal.show(
-        $t('users.changeStatusConfirmation.title'),
-        $t('users.changeStatusConfirmation.message', {
-          userName: $scope.user.user_name,
-          status: newStatus
-        })
-      ).then(function() {
-        User.setActive($scope.user.user_name, $scope.user.active)
-          .catch(function(data) {
-            Alert.error($t('common.alerts.cannotUpdateStatus'), data.data.message);
-            $scope.user.active = !$scope.user.active;
-          });
-      })
-      .catch(function() {
-        $scope.user.active = !$scope.user.active;
-      });
-    }
-  };    
-  $scope.toggleUserAdmin = function() {
-    if(!$scope.isCurrentUser){
-      var action = $scope.user.admin ?
-        $t('users.changePrivilegeConfirmation.revoke') : $t('users.changePrivilegeConfirmation.grant');
-      ConfirmationModal.show(
-        $t('users.changePrivilegeConfirmation.title'),
-        $t('users.changePrivilegeConfirmation.message', {
-          action: action,
-          userName: $scope.user.user_name
-        })
-      ).then(function() {
-        User.setAdmin($scope.user.user_name, $scope.user.admin)
-        .then(function() {
-          loadPrivileges();
-        })
-        .catch(function (data) {
-          Alert.error($t('common.alerts.cannotUpdateAdminStatus'), data.data.message);
-          $scope.user.admin = !$scope.user.admin;
-        });
-      })
-      .catch(function() {
-        $scope.user.admin = !$scope.user.admin;
-      });
-
-    }
-  };
-
-  $scope.removePrivilege = function(name, privilege) {
-    var privilegeObject = {
-        id: privilege.privilege_id,
-        view_name: privilege.view_name,
-        version: privilege.version,
-        instance_name: name
-    };
-    View.deletePrivilege(privilegeObject).then(function() {
-      loadPrivileges();
-    });
-  };
-
-  $scope.deleteUser = function() {
-    ConfirmationModal.show(
-      $t('common.delete', {
-        term: $t('common.user')
-      }),
-      $t('common.deleteConfirmation', {
-        instanceType: $t('common.user').toLowerCase(),
-        instanceName: '"' + $scope.user.user_name + '"'
-      })
-    ).then(function() {
-      Cluster.getPrivilegesForResource({
-        nameFilter : $scope.user.user_name,
-        typeFilter : {value: 'USER'}
-      }).then(function(data) {
-        var clusterPrivilegesIds = [];
-        var viewsPrivileges = [];
-        if (data.items && data.items.length) {
-          angular.forEach(data.items[0].privileges, function(privilege) {
-            if (privilege.PrivilegeInfo.principal_type === 'USER') {
-              if (privilege.PrivilegeInfo.type === 'VIEW') {
-                viewsPrivileges.push({
-                  id: privilege.PrivilegeInfo.privilege_id,
-                  view_name: privilege.PrivilegeInfo.view_name,
-                  version: privilege.PrivilegeInfo.version,
-                  instance_name: privilege.PrivilegeInfo.instance_name
-                });
-              } else {
-                clusterPrivilegesIds.push(privilege.PrivilegeInfo.privilege_id);
-              }
-            }
-          });
-        }
-        User.delete($scope.user.user_name).then(function() {
-          $location.path('/users');
-          if (clusterPrivilegesIds.length) {
-            Cluster.getAllClusters().then(function (clusters) {
-              var clusterName = clusters[0].Clusters.cluster_name;
-              Cluster.deleteMultiplePrivileges(clusterName, clusterPrivilegesIds);
-            });
-          }
-          angular.forEach(viewsPrivileges, function(privilege) {
-            View.deletePrivilege(privilege);
-          });
-        });
-      });
-    });
-  };
-
-  // Load privileges
-  function loadPrivileges(){
-    User.getPrivileges($routeParams.id).then(function(data) {
-      var privileges = {
-        clusters: {},
-        views: {}
-      };
-      angular.forEach(data.data.items, function(privilege) {
-        privilege = privilege.PrivilegeInfo;
-        if(privilege.type === 'CLUSTER'){
-          // This is cluster
-          if (privileges.clusters[privilege.cluster_name]) {
-            var preIndex = Cluster.orderedRoles.indexOf(privileges.clusters[privilege.cluster_name].permission_name);
-            var curIndex = Cluster.orderedRoles.indexOf(privilege.permission_name);
-            // replace when cur is a more powerful role
-            if (curIndex < preIndex) {
-              privileges.clusters[privilege.cluster_name] = privilege;
-            }
-          } else {
-            privileges.clusters[privilege.cluster_name] = privilege;
-          }
-        } else if ( privilege.type === 'VIEW'){
-          privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || { privileges:[]};
-          privileges.views[privilege.instance_name].version = privilege.version;
-          privileges.views[privilege.instance_name].view_name = privilege.view_name;
-          privileges.views[privilege.instance_name].privilege_id = privilege.privilege_id;
-          if (privileges.views[privilege.instance_name].privileges.indexOf(privilege.permission_label) == -1) {
-            privileges.views[privilege.instance_name].privileges.push(privilege.permission_label);
-          }
-        }
-      });
-
-      $scope.privileges = data.data.items.length ? privileges : null;
-      $scope.noClusterPriv = $.isEmptyObject(privileges.clusters);
-      $scope.noViewPriv = $.isEmptyObject(privileges.views);
-      $scope.hidePrivileges = $scope.noClusterPriv && $scope.noViewPriv;
-      $scope.dataLoaded = true;
-
-    }).catch(function(data) {
-      Alert.error($t('common.alerts.cannotLoadPrivileges'), data.data.message);
-    });
-  }
-  loadPrivileges();
-}]);