Interface AppUserService
- All Known Implementing Classes:
AppUserServiceImpl
@Service
public interface AppUserService
The
AppUserService
interface containing
methods for handling user related operations.-
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 its 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.
-
Method Details
-
getUserByUsername
This method is used to get the user by its username.- Parameters:
username
- The username of the user.- Returns:
- The
AppUser
object.
-
registerUser
This method is used to register a user.- Parameters:
user
- The user object.- Returns:
- The
AppUser
object.
-
getAllUsers
This method is used to fetch all users.- 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.- Parameters:
id
- The id of the user.- Returns:
- The username of the deleted user.
-
getUserById
Method for fetching a user by its id.- Parameters:
id
- the id of the user.- Returns:
- The
AppUser
object.
-
grantRoles
Method for granting roles to a user.- 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.- Parameters:
username
- The username of the user.roles
- The roles to be revoked separated by commas.- Returns:
- A status message.
-