* ============LICENSE_START==========================================
* ONAP Portal
* ===================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
$scope.goToUrl = function(roleIdVal) {
$state.go("root.role", {"roleId":roleIdVal});
}
+
$scope.toggleRole = function(appId, selected, availableRole) {
var toggleType = null;
if(selected) {
});
}
};
+
+ $scope.openBulkUploadRolesAndFunctionsModal = function(appId) {
+ var modalInstance = $modal.open({
+ templateUrl: 'app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html',
+ controller: 'BulkRoleAndFunctionsModalCtrl as bulkRoleAndFunctions',
+ sizeClass: 'modal-medium',
+ resolve: {
+ message: function () {
+ var message = {
+ appid: appId
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function (confirmed) {
+ if(confirmed == 'confirmed'){
+ // update role list table
+ }
+ });
+ };
- //getCentalizedApps
+ // getCentalizedApps
$scope.getCentralizedApps = function(userId) {
RoleService.getCentralizedApps(userId).then(res=> {
if (res.length>0) {
$scope.syncRolesFromExternalAuthSystem = function(appId){
applicationsService.syncRolesEcompFromExtAuthSystem(appId).then(function(res){
- if(res.status == 200){
+ if(res.data != null || res.data.status != null || res.data.status == 'OK'){
confirmBoxService.showInformation('Sync operation completed successfully!').then(isConfirmed => {
$scope.getRolesForSelectedCentralizedApp(appId);
});
} else{
- confirmBoxService.showInformation('Sync operation failed for '+app).then(isConfirmed => {});
+ confirmBoxService.showInformation('Sync operation failed for '+app + res.data.message).then(isConfirmed => {});
}
- });
+ }).catch(err=> {
+ confirmBoxService.showInformation("Sync operation failed for: " + err);
+ });
};
init();
- //edit Role
+ // edit Role
$scope.editRoleModalPopup = function(appId, availableRole) {
+ $scope.showSpinner = true;
+ if(!availableRole.active)
+ return confirmBoxService.showInformation('Edit is diabled! Please toggle the role to activate it.').then(isConfirmed => {});
$scope.editRole = availableRole;
if(appId != undefined && availableRole.id != undefined){
- RoleService.getRole(appId, availableRole.id).then(function(data){
+ RoleService.getRole(appId, availableRole.id).then(function(data){
+ $scope.showSpinner = false;
var response = JSON.parse(data.data);
var role = JSON.parse(response.role);
var availableRoles = JSON.parse(response.availableRoles);
availableRoleFunctions: availableRoleFunctions,
appId: $scope.apps.selectedCentralizedApp,
role: role
- };
+ };
return message;
}
}
});
},function(error){
$log.debug('Failed to editRole');
+ $scope.showSpinner = false;
});
}
};
- //add Role
+ // add Role
$scope.addRoleModalPopup = function(appId) {
+ $scope.showSpinner = true;
if(appId){
- var roleId = 0;
+ var roleId = -1;
RoleService.getRole(appId, roleId).then(function(data){
+ $scope.showSpinner = false;
var response = JSON.parse(data.data);
var role = JSON.parse(response.role);
var availableRoles = JSON.parse(response.availableRoles);