mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
added deletion to permissions lists
This commit is contained in:
parent
deee1bafc7
commit
85aee6af8c
@ -716,6 +716,66 @@ var tower = angular.module('Tower', [
|
||||
});
|
||||
};
|
||||
|
||||
$rootScope.deletePermissionFromUser = function (userId, userName, roleName, roleType, url) {
|
||||
var action = function () {
|
||||
$('#prompt-modal').modal('hide');
|
||||
Wait('start');
|
||||
Rest.setUrl(url);
|
||||
Rest.post({"disassociate": true, "id": userId})
|
||||
.success(function () {
|
||||
Wait('stop');
|
||||
$rootScope.$broadcast("refreshList", "permission");
|
||||
})
|
||||
.error(function (data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Could not disassociate user from role. Call to ' + url + ' failed. DELETE returned status: ' + status });
|
||||
});
|
||||
};
|
||||
|
||||
Prompt({
|
||||
hdr: `Remove role`,
|
||||
body: `
|
||||
<div class="Prompt-bodyQuery">
|
||||
Confirm the removal of the ${roleType}
|
||||
<span class="Prompt-emphasis"> ${roleName} </span>
|
||||
role associated with ${userName}.
|
||||
</div>
|
||||
`,
|
||||
action: action,
|
||||
actionText: 'REMOVE'
|
||||
});
|
||||
};
|
||||
|
||||
$rootScope.deletePermissionFromTeam = function (teamId, teamName, roleName, roleType, url) {
|
||||
var action = function () {
|
||||
$('#prompt-modal').modal('hide');
|
||||
Wait('start');
|
||||
Rest.setUrl(url);
|
||||
Rest.post({"disassociate": true, "id": teamId})
|
||||
.success(function () {
|
||||
Wait('stop');
|
||||
$rootScope.$broadcast("refreshList", "role");
|
||||
})
|
||||
.error(function (data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Could not disassociate team from role. Call to ' + url + ' failed. DELETE returned status: ' + status });
|
||||
});
|
||||
};
|
||||
|
||||
Prompt({
|
||||
hdr: `Remove role`,
|
||||
body: `
|
||||
<div class="Prompt-bodyQuery">
|
||||
Confirm the removal of the ${roleType}
|
||||
<span class="Prompt-emphasis"> ${roleName} </span>
|
||||
role associated with the ${teamName} team.
|
||||
</div>
|
||||
`,
|
||||
action: action,
|
||||
actionText: 'REMOVE'
|
||||
});
|
||||
};
|
||||
|
||||
function activateTab() {
|
||||
// Make the correct tab active
|
||||
var base = $location.path().replace(/^\//, '').split('/')[0];
|
||||
|
||||
@ -118,7 +118,16 @@ export default
|
||||
noSort: true
|
||||
}
|
||||
},
|
||||
fieldActions: {
|
||||
"delete": {
|
||||
label: 'Remove',
|
||||
ngClick: 'deletePermissionFromTeam(team_id, team_obj.name, role.name, role.summary_fields.resource_name, role.related.teams)',
|
||||
class: "List-actionButton--delete",
|
||||
iconClass: 'fa fa-times',
|
||||
awToolTip: 'Dissasociate permission from team'
|
||||
}
|
||||
},
|
||||
hideOnSuperuser: true
|
||||
}
|
||||
}
|
||||
},
|
||||
}); //InventoryForm
|
||||
|
||||
@ -162,8 +162,6 @@ export default
|
||||
iterator: 'permission',
|
||||
open: false,
|
||||
index: false,
|
||||
actions: {},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
label: 'Name',
|
||||
@ -180,6 +178,14 @@ export default
|
||||
label: 'Role',
|
||||
ngBind: 'permission.name',
|
||||
noSort: true
|
||||
},
|
||||
},
|
||||
fieldActions: {
|
||||
"delete": {
|
||||
label: 'Remove',
|
||||
ngClick: 'deletePermissionFromUser(user_id, username, permission.name, permission.summary_fields.resource_name, permission.related.users)',
|
||||
iconClass: 'fa fa-times',
|
||||
awToolTip: 'Dissasociate permission from user'
|
||||
}
|
||||
},
|
||||
hideOnSuperuser: true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user