Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.
Merged

Dev #34

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
935841b
chore: trigger GitOps pipeline (empty commit)
RandithaK Nov 15, 2025
26fa0f8
Merge pull request #32 from TechTorque-2025/feat/gitops-workflow
RandithaK Nov 21, 2025
7bbebcc
Add comprehensive repository tests for Role, User, UserPreferences, a…
AdithaBuwaneka Nov 21, 2025
9748b1b
feat: Add comprehensive unit tests for AuthService including authenti…
AdithaBuwaneka Nov 21, 2025
9df11de
feat: Add comprehensive unit tests for UserService covering user mana…
AdithaBuwaneka Nov 21, 2025
9b62425
feat: Update role IDs to use Long type and add comprehensive tests fo…
AdithaBuwaneka Nov 21, 2025
e32f8bf
refactor: Improve readability of authority retrieval in AuthServiceTest
AdithaBuwaneka Nov 21, 2025
355f72c
refactor: Simplify authority retrieval in AuthServiceTest
AdithaBuwaneka Nov 21, 2025
52002b0
refactor: Optimize authority retrieval in AuthServiceTest
AdithaBuwaneka Nov 21, 2025
98f3c03
refactor: Replace array list with singleton for user authorities in A…
AdithaBuwaneka Nov 21, 2025
f3857e6
refactor: Consolidate mock declarations and setup in AuthServiceTest …
AdithaBuwaneka Nov 21, 2025
88a9292
refactor: Replace array list with singleton for authorities in AuthSe…
AdithaBuwaneka Nov 21, 2025
f60fe28
refactor: Replace array list with singleton for authorities in AuthSe…
AdithaBuwaneka Nov 21, 2025
0dab850
refactor: Improve readability of authority retrieval in UserServiceTest
AdithaBuwaneka Nov 21, 2025
3c4b79c
refactor: Update mock request IP address and email verification in Au…
AdithaBuwaneka Nov 21, 2025
729741f
refactor: Simplify tokenService.createRefreshToken calls in AuthServi…
AdithaBuwaneka Nov 21, 2025
fa2d0b8
refactor: Use lenient stubbing for request IP address in AuthServiceTest
AdithaBuwaneka Nov 21, 2025
4424cf0
refactor: Update tokenService.createRefreshToken calls to use fixed I…
AdithaBuwaneka Nov 21, 2025
17aae48
refactor: Use lenient stubbing for userRepository in AuthServiceTest …
AdithaBuwaneka Nov 21, 2025
3ec4611
refactor: Use lenient stubbing for userRepository in UserServiceTest
AdithaBuwaneka Nov 21, 2025
55d9b9e
refactor: Use lenient stubbing for roleRepository in UserServiceTest
AdithaBuwaneka Nov 21, 2025
90d51f0
refactor: Use lenient stubbing for roleRepository in UserServiceTest
AdithaBuwaneka Nov 21, 2025
486cd81
Merge pull request #33 from TechTorque-2025/Authentication-mvn-test
AdithaBuwaneka Nov 21, 2025
a54e307
fix: Remove unnecessary blank line in pom.xml
RandithaK Nov 21, 2025
4d9422e
feat: Add email and token services to UserService for sending user ve…
RandithaK Nov 21, 2025
cd79dc3
feat: Add API endpoints and service logic for creating admin and empl…
RandithaK Nov 21, 2025
9c45cf0
feat: Add Maven Compiler Plugin configuration for Lombok annotation p…
RandithaK Nov 23, 2025
dcebe8a
feat: Implement user authorization checks in UserController and add U…
RandithaK Nov 23, 2025
4d90511
Merge branch 'main' into dev
RandithaK Nov 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion auth-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<scope>runtime</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down Expand Up @@ -177,6 +177,18 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
@RequestMapping("/users")
// CORS handled by API Gateway; remove @CrossOrigin to avoid conflicts
// @CrossOrigin(origins = "*", maxAge = 3600)
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
@Tag(name = "User Management", description = "User management endpoints (Admin/Super Admin only)")
@SecurityRequirement(name = "bearerAuth")
public class UserController {
Expand All @@ -44,6 +43,7 @@ public class UserController {
* Get a list of all users in the system.
*/
@GetMapping
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
public ResponseEntity<List<UserDto>> getAllUsers(@RequestParam(required = false) String role) {
List<UserDto> users = userService.findAllUsers().stream()
.map(this::convertToDto)
Expand All @@ -56,6 +56,7 @@ public ResponseEntity<List<UserDto>> getAllUsers(@RequestParam(required = false)
* Get detailed information for a single user by their username.
*/
@GetMapping("/{username}")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
public ResponseEntity<UserDto> getUserByUsername(@PathVariable String username) {
return userService.findByUsername(username)
.map(user -> ResponseEntity.ok(convertToDto(user)))
Expand All @@ -66,6 +67,7 @@ public ResponseEntity<UserDto> getUserByUsername(@PathVariable String username)
* Disable a user's account.
*/
@PostMapping("/{username}/disable")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
public ResponseEntity<?> disableUser(@PathVariable String username) {
try {
userService.disableUser(username);
Expand All @@ -79,6 +81,7 @@ public ResponseEntity<?> disableUser(@PathVariable String username) {
* Enable a user's account.
*/
@PostMapping("/{username}/enable")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
public ResponseEntity<?> enableUser(@PathVariable String username) {
try {
userService.enableUser(username);
Expand All @@ -102,6 +105,7 @@ public ResponseEntity<?> unlockUser(@PathVariable String username) {
* Delete a user from the system permanently.
*/
@DeleteMapping("/{username}")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
public ResponseEntity<?> deleteUser(@PathVariable String username) {
try {
userService.deleteUser(username);
Expand All @@ -116,6 +120,7 @@ public ResponseEntity<?> deleteUser(@PathVariable String username) {
* PUT /api/v1/users/{username}
*/
@PutMapping("/{username}")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
public ResponseEntity<?> updateUser(@PathVariable String username,
@Valid @RequestBody UpdateUserRequest updateRequest) {
try {
Expand All @@ -136,6 +141,7 @@ public ResponseEntity<?> updateUser(@PathVariable String username,
* POST /api/v1/users/{username}/reset-password
*/
@PostMapping("/{username}/reset-password")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPER_ADMIN')")
public ResponseEntity<?> resetUserPassword(@PathVariable String username,
@Valid @RequestBody ResetPasswordRequest resetRequest) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
@AllArgsConstructor
@Builder
public class CreateAdminRequest {

private String username;
private String email;
private String password;


private String fullName;

// Optional: Additional admin-specific fields
private String firstName;
private String lastName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
@AllArgsConstructor
@Builder
public class CreateEmployeeRequest {

private String username;
private String email;
private String password;


private String fullName;

// Optional: Additional employee-specific fields
private String firstName;
private String lastName;
Expand Down
Loading