diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js
index a79460b0ea..b3a2802df3 100644
--- a/awx/ui/client/src/app.js
+++ b/awx/ui/client/src/app.js
@@ -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: `
+
+ Confirm the removal of the ${roleType}
+ ${roleName}
+ role associated with ${userName}.
+
+ `,
+ 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: `
+
+ Confirm the removal of the ${roleType}
+ ${roleName}
+ role associated with the ${teamName} team.
+
+ `,
+ action: action,
+ actionText: 'REMOVE'
+ });
+ };
+
function activateTab() {
// Make the correct tab active
var base = $location.path().replace(/^\//, '').split('/')[0];
diff --git a/awx/ui/client/src/forms/Teams.js b/awx/ui/client/src/forms/Teams.js
index 9c9d3b6812..4d56a75f7e 100644
--- a/awx/ui/client/src/forms/Teams.js
+++ b/awx/ui/client/src/forms/Teams.js
@@ -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
diff --git a/awx/ui/client/src/forms/Users.js b/awx/ui/client/src/forms/Users.js
index d115ae3011..954a61225b 100644
--- a/awx/ui/client/src/forms/Users.js
+++ b/awx/ui/client/src/forms/Users.js
@@ -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