use of com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminUnassignsUserFromProject in project sechub by mercedes-benz.
the class ProjectUnassignUserService method unassignUserFromProject.
/* @formatter:off */
@UseCaseAdminUnassignsUserFromProject(@Step(number = 2, name = "Unassign user", description = "The service will remove the user to the project. If users has no longer access to projects ROLE_USER will be removed"))
public /* @formatter:on */
void unassignUserFromProject(String userId, String projectId) {
auditLogService.log("triggers unassignment of user:{} to project:{}", logSanitizer.sanitize(userId, 30), logSanitizer.sanitize(projectId, 30));
assertion.assertIsValidUserId(userId);
assertion.assertIsValidProjectId(projectId);
Project project = projectRepository.findOrFailProject(projectId);
User user = userRepository.findOrFailUser(userId);
if (!project.getUsers().remove(user)) {
throw new AlreadyExistsException("User already not assigned to this project!");
}
user.getProjects().remove(project);
transactionService.saveInOwnTransaction(project, user);
sendUserRemovedFromProjectEvent(projectId, user);
sendRequestUserRoleRecalculation(user);
}
use of com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminUnassignsUserFromProject in project sechub by mercedes-benz.
the class ScheduleRevokeUserAccessFromProjectService method revokeUserAccessFromProject.
@UseCaseAdminUnassignsUserFromProject(@Step(number = 2, name = "Update authorization parts"))
public void revokeUserAccessFromProject(String userId, String projectId) {
assertion.assertIsValidUserId(userId);
assertion.assertIsValidProjectId(projectId);
ProjectAccessCompositeKey id = new ProjectAccessCompositeKey(userId, projectId);
repository.deleteById(id);
LOG.info("Revoked access to project:{} for user:{}", projectId, userId);
}
use of com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminUnassignsUserFromProject in project sechub by mercedes-benz.
the class ScanRevokeUserAccessFromProjectService method revokeUserAccessFromProject.
@UseCaseAdminUnassignsUserFromProject(@Step(number = 2, name = "Update authorization parts"))
public void revokeUserAccessFromProject(String userId, String projectId) {
assertion.assertIsValidUserId(userId);
assertion.assertIsValidProjectId(projectId);
ProjectAccessCompositeKey id = new ProjectAccessCompositeKey(userId, projectId);
repository.deleteById(id);
LOG.info("Revoked access to project:{} for user:{}", projectId, userId);
}
Aggregations