Class AppUserServiceImpl

java.lang.Object
com.markvarga21.studentmanager.service.auth.impl.AppUserServiceImpl
All Implemented Interfaces:
AppUserService

@Service public class AppUserServiceImpl extends Object implements AppUserService
The AppUserServiceImpl class is used to implement the AppUserService interface.
  • Constructor Details

    • AppUserServiceImpl

      public AppUserServiceImpl()
  • Method Details

    • getUserByUsername

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

      public AppUser registerUser(AppUser user)
      This method is used to register a user.
      Specified by:
      registerUser in interface AppUserService
      Parameters:
      user - The user object.
      Returns:
      The AppUser object.
    • getAllUsers

      public org.springframework.data.domain.Page<AppUser> getAllUsers(Integer page, Integer size)
      This method is used to fetch all users.
      Specified by:
      getAllUsers in interface AppUserService
      Parameters:
      page - The page number.
      size - The number of users in a single page.
      Returns:
      A page of users.
    • deleteUserById

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

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

      public String grantRoles(String username, String roles)
      Method for granting roles to a user.
      Specified by:
      grantRoles in interface AppUserService
      Parameters:
      username - The username of the user.
      roles - The roles to be granted separated by commas.
      Returns:
      A status message.
    • revokeRoles

      public String revokeRoles(String username, String roles)
      Method for revoking roles from a user.
      Specified by:
      revokeRoles in interface AppUserService
      Parameters:
      username - The username of the user.
      roles - The roles to be revoked separated by commas.
      Returns:
      A status message.