Class UserProfiles

java.lang.Object
com.kingsrook.qqq.backend.core.actions.profile.UserProfiles

public final class UserProfiles extends Object
Read side and security of the core user profile: a user's row, their avatar (addressed by an opaque avatarId, never by user id or email) and its storage objects, the record-lock keys for sessions, and the values a session sends to its frontend. Lookups of other users run as the system (avatars are visible to every signed-in user); the write side is UserProfilePreferenceProvider, for the signed-in user only.
  • Field Details

  • Method Details

    • settings

      public static UserProfilesMetaData settings()
      The installed profile settings, or null.
    • applyToSession

      public static void applyToSession(QSession session)
      Give a session its profile record-lock keys: user_profile_user = its user id, and the all-access key when it holds user_profile_admin. Hosts call this when they build sessions (as for durable jobs); the profile provider also ensures it before writing. No-op for null and system sessions.
    • applyIfInstalled

      public static void applyIfInstalled(QInstance qInstance, QSession session)
      Stamp the keys on a session the framework just finalized (each UI API request, each automated session for jobs, schedules and deliveries), when the instance installs profiles. Additive only (a cached session shared by concurrent requests never loses its keys midway). Never throws.
    • ensureSessionKeys

      public static void ensureSessionKeys(QSession session)
      Apply the keys only when the session has none yet.
    • find

      public static QRecord find(String userId) throws QException
      A user's profile row, or null (also null when profiles aren't installed).
      Throws:
      QException
    • findByAvatarId

      public static QRecord findByAvatarId(String avatarId) throws QException
      The profile row with an avatarId, or null.
      Throws:
      QException
    • lookup

      public static Map<String,String> lookup(Collection<String> userIds) throws QException
      Avatar URLs of up to MAX_LOOKUP_USER_IDS users; users without one are left out (clients draw their initials).
      Throws:
      QException
    • avatarOf

      public static UserProfiles.Avatar avatarOf(QRecord row)
      The avatar a profile row shows, or null for none (initials).
    • avatarUrl

      public static String avatarUrl(UserProfiles.Avatar avatar)
      The relative URL of an avatar (add size=32|64|128|256).
    • avatarObject

      public static StorageInput avatarObject(String avatarKey, int size)
      The storage object of one size of an avatar.
    • frontendUserValues

      public static Map<String,Serializable> frontendUserValues(QInstance qInstance, QSession session)
      The profile values a session sends its frontend under values.user: avatarUrl (when the user has a photo or Gravatar) and displayName (when set). Empty when profiles aren't installed. Never throws: a profile lookup must not break signing in.