Changeset 8038 for branches/3.19-stable


Ignore:
Timestamp:
May 25, 2022, 10:44:28 AM (10 months ago)
Author:
Nicklas Nordborg
Message:

References #2278: Improvements to login page for better extensions

Sessions settings are now stored directly in the SessionControl which doesn't require that a user is logged in.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.19-stable/src/core/net/sf/basedb/core/SessionControl.java

    r7962 r8038  
    143143  */
    144144  private boolean closed;
     145
     146  /**
     147    Stores name and value of session settings.
     148    @since 3.19.3
     149  */
     150  private Map<String,Object> sessionSettings;
    145151 
    146152  /**
     
    188194    this.currentClient = parent.currentClient;
    189195    this.remoteId = parent.remoteId;
     196    this.sessionSettings = parent.sessionSettings;
    190197    this.dbControlCache = Collections.synchronizedMap(new WeakHashMap<DbControl,String>());
    191198    this.currentContexts = parent.currentContexts;
     
    219226    this.id = id;
    220227    this.remoteId = remoteId;
     228    this.sessionSettings = Collections.synchronizedMap(new HashMap<String,Object>());
    221229    this.dbControlCache = Collections.synchronizedMap(new WeakHashMap<DbControl,String>());
    222230    this.currentContexts = Collections.synchronizedMap(new HashMap<ContextKey, ItemContext>());
     
    12371245    li.userName = userData.getName();
    12381246    li.authenticationMethod = authenticationMethod;
    1239     li.sessionSettings = Collections.synchronizedMap(new HashMap<String,Object>());
    12401247    return li;
    12411248  }
     
    12911298    currentContexts.clear();
    12921299    allowedClients.clear();
     1300    sessionSettings.clear();
    12931301    loginInfo = null;
    12941302  }
     
    25932601  public <T> T getSessionSetting(String name)
    25942602  {
    2595     return loginInfo == null ? null : (T)loginInfo.sessionSettings.get(name);
     2603    return (T)sessionSettings.get(name);
    25962604  }
    25972605
     
    26072615  public <T> T setSessionSetting(String name, Object value)
    26082616  {
    2609     if (loginInfo == null || loginInfo.sessionSettings == null) return null;
    26102617    if (value == null)
    26112618    {
    2612       return (T)loginInfo.sessionSettings.remove(name);
     2619      return (T)sessionSettings.remove(name);
    26132620    }
    26142621    else
    26152622    {
    2616       return (T)loginInfo.sessionSettings.put(name, value);
     2623      return (T)sessionSettings.put(name, value);
    26172624    }
    26182625  }
     
    29382945    private Map<String,SettingInfo> userDefaultSettings;
    29392946
    2940     /**
    2941       Stores name and value of session settings.
    2942     */
    2943     private Map<String,Object> sessionSettings;
    2944 
    29452947    private LoginInfo()
    29462948    {}
     
    29612963      this.userClientSettings = parent.userClientSettings;
    29622964      this.userDefaultSettings = parent.userDefaultSettings;
    2963       this.sessionSettings = parent.sessionSettings;
    29642965    }
    29652966   
Note: See TracChangeset for help on using the changeset viewer.