|
@ -12,6 +12,22 @@ |
|
|
|
|
|
|
|
|
var lilikAddUserApp = angular.module('lilikAddUserApp', []); |
|
|
var lilikAddUserApp = angular.module('lilikAddUserApp', []); |
|
|
|
|
|
|
|
|
|
|
|
lilikAddUserApp.filter('excludeKey', function() { |
|
|
|
|
|
return function(input, search) { |
|
|
|
|
|
if (!input) return input; |
|
|
|
|
|
if (!search) return input; |
|
|
|
|
|
var excluded_key = ('' + search); |
|
|
|
|
|
var result = {}; |
|
|
|
|
|
angular.forEach(input, function(value, key) { |
|
|
|
|
|
var actual_key = ('' + key); |
|
|
|
|
|
if (actual_key != excluded_key) { |
|
|
|
|
|
result[key] = value; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
lilikAddUserApp.controller('AddUserController', function AddUserController($scope, $http) { |
|
|
lilikAddUserApp.controller('AddUserController', function AddUserController($scope, $http) { |
|
|
// Initialize scope variable
|
|
|
// Initialize scope variable
|
|
|
$scope.showLoginForm = true; |
|
|
$scope.showLoginForm = true; |
|
@ -19,11 +35,16 @@ |
|
|
$scope.showConfirmForm = false; |
|
|
$scope.showConfirmForm = false; |
|
|
$scope.startConfirm = false; |
|
|
$scope.startConfirm = false; |
|
|
$scope.creationPending = false; |
|
|
$scope.creationPending = false; |
|
|
|
|
|
$scope.newExtraGroups = []; |
|
|
|
|
|
|
|
|
$scope.typingUser = function () { |
|
|
$scope.typingUser = function () { |
|
|
$scope.newUid = $scope.newUid.toLowerCase().replace(' ', '-'); |
|
|
$scope.newUid = $scope.newUid.toLowerCase().replace(' ', '-'); |
|
|
$scope.newCn = $scope.newUid.replace('-',' ').replace(/(^\w|\s\w)/g, m => m.toUpperCase()); |
|
|
$scope.newCn = $scope.newUid.replace('-',' ').replace(/(^\w|\s\w)/g, m => m.toUpperCase()); |
|
|
}; |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.notPrincipal = function (group) { |
|
|
|
|
|
return group.key !== $scope.newGroup; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Try to login and download groups
|
|
|
// Try to login and download groups
|
|
|
$scope.getGroups = function () { |
|
|
$scope.getGroups = function () { |
|
@ -52,7 +73,8 @@ |
|
|
$scope.confirmNewUser = function () { |
|
|
$scope.confirmNewUser = function () { |
|
|
newEntry = { |
|
|
newEntry = { |
|
|
"cn": $scope.newCn, |
|
|
"cn": $scope.newCn, |
|
|
"sn": $scope.newSn |
|
|
|
|
|
|
|
|
"sn": $scope.newSn, |
|
|
|
|
|
"memberOf": $scope.newExtraGroups |
|
|
}; |
|
|
}; |
|
|
$http.post('../user_backend/group/'+$scope.newGroup+'/create/'+$scope.newUid, |
|
|
$http.post('../user_backend/group/'+$scope.newGroup+'/create/'+$scope.newUid, |
|
|
{ |
|
|
{ |
|
@ -67,7 +89,7 @@ |
|
|
} else { |
|
|
} else { |
|
|
$scope.createError = result.reason; |
|
|
$scope.createError = result.reason; |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// Clear old user scope variable and start creating another
|
|
|
// Clear old user scope variable and start creating another
|
|
@ -77,6 +99,7 @@ |
|
|
delete $scope.newUid; |
|
|
delete $scope.newUid; |
|
|
delete $scope.newCn; |
|
|
delete $scope.newCn; |
|
|
delete $scope.newSn; |
|
|
delete $scope.newSn; |
|
|
|
|
|
$scope.newExtraGroups = []; |
|
|
$scope.startConfirm = false; |
|
|
$scope.startConfirm = false; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|