mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 11:11:07 -03:30
added deletion to permissions lists
This commit is contained in:
@@ -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() {
|
function activateTab() {
|
||||||
// Make the correct tab active
|
// Make the correct tab active
|
||||||
var base = $location.path().replace(/^\//, '').split('/')[0];
|
var base = $location.path().replace(/^\//, '').split('/')[0];
|
||||||
|
|||||||
@@ -118,7 +118,16 @@ export default
|
|||||||
noSort: true
|
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
|
hideOnSuperuser: true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}); //InventoryForm
|
}); //InventoryForm
|
||||||
|
|||||||
@@ -162,8 +162,6 @@ export default
|
|||||||
iterator: 'permission',
|
iterator: 'permission',
|
||||||
open: false,
|
open: false,
|
||||||
index: false,
|
index: false,
|
||||||
actions: {},
|
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
@@ -180,6 +178,14 @@ export default
|
|||||||
label: 'Role',
|
label: 'Role',
|
||||||
ngBind: 'permission.name',
|
ngBind: 'permission.name',
|
||||||
noSort: true
|
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
|
hideOnSuperuser: true
|
||||||
|
|||||||
Reference in New Issue
Block a user