use of com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminGrantsAdminRightsToUser in project sechub by mercedes-benz.
the class UserGrantSuperAdminRightsService method grantSuperAdminRightsFor.
/* @formatter:off */
@Validated
@UseCaseAdminGrantsAdminRightsToUser(@Step(number = 2, name = "Service grants user admin rights.", next = { 3, 4 }, description = "The service will grant user admin righs and triggers asynchronous events"))
public /* @formatter:on */
void grantSuperAdminRightsFor(String userId) {
auditLogService.log("Triggered granting admin rights for user {}", logSanitizer.sanitize(userId, 30));
assertion.assertIsValidUserId(userId);
User user = userRepository.findOrFailUser(userId);
if (user.isSuperAdmin()) {
LOG.info("User:{} was already a super administrator, so just ignored", user.getName());
return;
}
user.superAdmin = true;
userRepository.save(user);
requestUserRoleRecalculaton(user);
informUserBecomesSuperadmin(user);
}
use of com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminGrantsAdminRightsToUser in project sechub by mercedes-benz.
the class InformAdminsThatUserBecomesAdminNotificationService method notify.
@UseCaseAdminGrantsAdminRightsToUser(@Step(number = 4, next = { Step.NO_NEXT_STEP }, name = "Inform SecHub admins that another user became administrator"))
public void notify(UserMessage userMessage, String baseUrl) {
SimpleMailMessage message = factory.createMessage("SecHub: Granted administrator rights to " + userMessage.getUserId());
message.setTo(notificationConfiguration.getEmailAdministrators());
message.setText(createEmailContent(userMessage, baseUrl));
emailService.send(message);
}
use of com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminGrantsAdminRightsToUser in project sechub by mercedes-benz.
the class InformUserThatUserBecomesAdminNotificationService method notify.
@UseCaseAdminGrantsAdminRightsToUser(@Step(number = 3, next = { 4 }, name = "Inform user that he/she became administrator"))
public void notify(UserMessage userMessage, String baseUrl) {
SimpleMailMessage message = factory.createMessage("SecHub administrator privileges granted");
message.setTo(userMessage.getEmailAdress());
message.setText(createEmailContent(userMessage, baseUrl));
emailService.send(message);
}
Aggregations