Class AppUserServiceImpl
java.lang.Object
com.markvarga21.studentmanager.service.auth.impl.AppUserServiceImpl
- All Implemented Interfaces:
AppUserService
The
AppUserServiceImpl
class is used to implement
the AppUserService
interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteUserById
(Long id) Method for deleting a user from the database.org.springframework.data.domain.Page<AppUser>
getAllUsers
(Integer page, Integer size) This method is used to fetch all users.getUserById
(Long id) Method for fetching a user by its id.getUserByUsername
(String username) This method is used to get the user by the username.grantRoles
(String username, String roles) Method for granting roles to a user.registerUser
(AppUser user) This method is used to register a user.revokeRoles
(String username, String roles) Method for revoking roles from a user.
-
Constructor Details
-
AppUserServiceImpl
public AppUserServiceImpl()
-
-
Method Details
-
getUserByUsername
This method is used to get the user by the username.- Specified by:
getUserByUsername
in interfaceAppUserService
- Parameters:
username
- The username of the user.- Returns:
- The
AppUser
object.
-
registerUser
This method is used to register a user.- Specified by:
registerUser
in interfaceAppUserService
- Parameters:
user
- The user object.- Returns:
- The
AppUser
object.
-
getAllUsers
This method is used to fetch all users.- Specified by:
getAllUsers
in interfaceAppUserService
- Parameters:
page
- The page number.size
- The number of users in a single page.- Returns:
- A page of users.
-
deleteUserById
Method for deleting a user from the database.- Specified by:
deleteUserById
in interfaceAppUserService
- Parameters:
id
- The id of the user.- Returns:
- The username of the deleted user.
-
getUserById
Method for fetching a user by its id.- Specified by:
getUserById
in interfaceAppUserService
- Parameters:
id
- the id of the user.- Returns:
- The
AppUser
object.
-
grantRoles
Method for granting roles to a user.- Specified by:
grantRoles
in interfaceAppUserService
- Parameters:
username
- The username of the user.roles
- The roles to be granted separated by commas.- Returns:
- A status message.
-
revokeRoles
Method for revoking roles from a user.- Specified by:
revokeRoles
in interfaceAppUserService
- Parameters:
username
- The username of the user.roles
- The roles to be revoked separated by commas.- Returns:
- A status message.
-