Class CurrentUser

java.lang.Object
com.github.marschall.memoryfilesystem.CurrentUser

public final class CurrentUser extends Object
Provides access to the current user.
  • Method Details

    • useDuring

      public static <V> V useDuring(UserPrincipal user, CurrentUser.UserTask<V> task) throws IOException
      Sets the current user for a certain period.
      Type Parameters:
      V - the type of the return value
      Parameters:
      user - the user to use
      task - during this task the given user will be used, will be called immediately by the current thread
      Returns:
      what the task returned
      Throws:
      IOException - if any of the code in the task throws an IOException
    • useDuring

      public static void useDuring(UserPrincipal user, CurrentUser.VoidUserTask task) throws IOException
      Sets the current user for a certain period.
      Parameters:
      user - the user to use
      task - during this task the given user will be used, will be called immediately by the current thread
      Throws:
      IOException - if any of the code in the task throws an IOException
      Since:
      2.4.0