Consolidate data access control backoffice updates
This commit is contained in:
@@ -15,21 +15,21 @@ public class UserService {
|
||||
|
||||
private final UserMapper userMapper;
|
||||
private final AuditService auditService;
|
||||
private final DdsAuthorizationChangeNotifier ddsAuthorizationChangeNotifier;
|
||||
private final ExternalAuthorizationChangeNotifier authorizationChangeNotifier;
|
||||
|
||||
@Autowired
|
||||
public UserService(
|
||||
UserMapper userMapper,
|
||||
AuditService auditService,
|
||||
DdsAuthorizationChangeNotifier ddsAuthorizationChangeNotifier
|
||||
ExternalAuthorizationChangeNotifier authorizationChangeNotifier
|
||||
) {
|
||||
this.userMapper = userMapper;
|
||||
this.auditService = auditService;
|
||||
this.ddsAuthorizationChangeNotifier = ddsAuthorizationChangeNotifier;
|
||||
this.authorizationChangeNotifier = authorizationChangeNotifier;
|
||||
}
|
||||
|
||||
public UserService(UserMapper userMapper, AuditService auditService) {
|
||||
this(userMapper, auditService, DdsAuthorizationChangeNotifier.noop());
|
||||
this(userMapper, auditService, ExternalAuthorizationChangeNotifier.noop());
|
||||
}
|
||||
|
||||
public List<AppUser> findAll() {
|
||||
@@ -45,7 +45,7 @@ public class UserService {
|
||||
long userId = userMapper.nextUserId();
|
||||
userMapper.insertUser(userId, command);
|
||||
auditService.record(new AuditEvent("USER_CREATED", null, null, "SUCCESS", null, null, command.username()));
|
||||
ddsAuthorizationChangeNotifier.changed("USER_CREATED");
|
||||
authorizationChangeNotifier.changed("USER_CREATED");
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -56,7 +56,7 @@ public class UserService {
|
||||
}
|
||||
auditService.record(new AuditEvent("USER_ACTIVE_CHANGED", null, null, "SUCCESS", null, null,
|
||||
"userId=" + userId + ",active=" + active));
|
||||
ddsAuthorizationChangeNotifier.changed("USER_ACTIVE_CHANGED");
|
||||
authorizationChangeNotifier.changed("USER_ACTIVE_CHANGED");
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -64,7 +64,7 @@ public class UserService {
|
||||
userMapper.insertUserRole(userId, roleId);
|
||||
auditService.record(new AuditEvent("USER_ROLE_GRANTED", null, null, "SUCCESS", null, null,
|
||||
"userId=" + userId + ",roleId=" + roleId));
|
||||
ddsAuthorizationChangeNotifier.changed("USER_ROLE_GRANTED");
|
||||
authorizationChangeNotifier.changed("USER_ROLE_GRANTED");
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -75,6 +75,6 @@ public class UserService {
|
||||
}
|
||||
auditService.record(new AuditEvent("USER_ROLE_REVOKED", null, null, "SUCCESS", null, null,
|
||||
"userId=" + userId + ",roleId=" + roleId));
|
||||
ddsAuthorizationChangeNotifier.changed("USER_ROLE_REVOKED");
|
||||
authorizationChangeNotifier.changed("USER_ROLE_REVOKED");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user