use of org.jboss.hal.client.accesscontrol.AccessControlTasks.RemoveRoleMapping in project console by hal.
the class RoleColumn method removeScopedRole.
// ------------------------------------------------------ remove roles
private void removeScopedRole(Role role, String type) {
List<Task<FlowContext>> tasks = new ArrayList<>();
List<Assignment> assignments = accessControl.assignments().byRole(role).collect(toList());
if (!assignments.isEmpty()) {
tasks.add(new RemoveAssignments(dispatcher, assignments));
}
tasks.add(new CheckRoleMapping(dispatcher, role));
tasks.add(new RemoveRoleMapping(dispatcher, role, status -> status == 200));
tasks.add(new RemoveScopedRole(dispatcher, role));
series(new FlowContext(progress.get()), tasks).subscribe(new SuccessfulOutcome<FlowContext>(eventBus, resources) {
@Override
public void onSuccess(FlowContext context) {
MessageEvent.fire(eventBus, Message.success(resources.messages().removeResourceSuccess(type, role.getName())));
accessControl.reload(() -> {
refresh(RefreshMode.CLEAR_SELECTION);
eventBus.fireEvent(new RolesChangedEvent());
});
}
});
}
Aggregations