Interface AppUserService

All Known Implementing Classes:
AppUserServiceImpl

@Service public interface AppUserService
The AppUserService interface containing methods for handling user related operations.
  • Method Details

    • getUserByUsername

      Optional<AppUser> getUserByUsername(String username)
      This method is used to get the user by its username.
      Parameters:
      username - The username of the user.
      Returns:
      The AppUser object.
    • registerUser

      AppUser registerUser(AppUser user)
      This method is used to register a user.
      Parameters:
      user - The user object.
      Returns:
      The AppUser object.
    • getAllUsers

      org.springframework.data.domain.Page<AppUser> getAllUsers(Integer page, Integer size)
      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

      String deleteUserById(Long id)
      Method for deleting a user from the database.
      Parameters:
      id - The id of the user.
      Returns:
      The username of the deleted user.
    • getUserById

      AppUser getUserById(Long id)
      Method for fetching a user by its id.
      Parameters:
      id - the id of the user.
      Returns:
      The AppUser object.
    • grantRoles

      String grantRoles(String username, String roles)
      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

      String revokeRoles(String username, String roles)
      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.