Class Utils


  • public final class Utils
    extends Object
    • Method Detail

      • canImpersonateAllUsers

        public static boolean canImpersonateAllUsers​(@NotNull
                                                     @NotNull Principal principal,
                                                     @NotNull
                                                     @NotNull UserManager userManager)
        Return true if the given principal can impersonate all users. The implementation tests if the given principal refers to an existing User for which User.isAdmin() returns true OR if the user's principal name or any of its membership is configured to impersonate all users.
        Parameters:
        principal - A non-null principal instance.
        userManager - The user manager used for the lookup calling {@link UserManager#getAuthorizable(Principal))}
        Returns:
        true if the given principal can impersonate all users; false if that condition is not met or if the evaluation failed.
      • isAdmin

        public static boolean isAdmin​(@NotNull
                                      @NotNull Principal principal,
                                      @NotNull
                                      @NotNull UserManager userManager)
        Return true if the given principal is admin. The implementation tests if the given principal refers to an existing User for which User.isAdmin() returns true.
        Parameters:
        principal - A non-null principal instance.
        userManager - The user manager used for the lookup calling {@link UserManager#getAuthorizable(Principal))}
        Returns:
        true if the given principal is admin; false if that condition is not met or if the evaluation failed.