mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-20 22:18:43 +00:00
CE-937 Remove withSecurityKeyValues that took a list and added all of them - felt a little unclear (did it replace or append to the list under the key?). now just replace the entire Map<String, List<Serializable>> yourself, or add them one-by-one. Updated tests accordingly.
This commit is contained in:
@ -48,6 +48,7 @@ public class QSession implements Serializable
|
||||
private String uuid;
|
||||
|
||||
private Set<String> permissions;
|
||||
|
||||
private Map<String, List<Serializable>> securityKeyValues;
|
||||
private Map<String, Serializable> backendVariants;
|
||||
|
||||
@ -337,15 +338,10 @@ public class QSession implements Serializable
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for securityKeyValues - add a list of values for 1 key
|
||||
** Fluent setter for securityKeyValues - add 1 value for 1 key.
|
||||
*******************************************************************************/
|
||||
public QSession withSecurityKeyValues(String keyName, List<Serializable> values)
|
||||
public QSession withSecurityKeyValue(String keyName, Serializable value)
|
||||
{
|
||||
if(values == null)
|
||||
{
|
||||
return (this);
|
||||
}
|
||||
|
||||
if(securityKeyValues == null)
|
||||
{
|
||||
securityKeyValues = new HashMap<>();
|
||||
@ -355,12 +351,15 @@ public class QSession implements Serializable
|
||||
|
||||
try
|
||||
{
|
||||
securityKeyValues.get(keyName).addAll(values);
|
||||
securityKeyValues.get(keyName).add(value);
|
||||
}
|
||||
catch(UnsupportedOperationException uoe)
|
||||
{
|
||||
/////////////////////
|
||||
// grr, List.of... //
|
||||
/////////////////////
|
||||
securityKeyValues.put(keyName, new ArrayList<>(securityKeyValues.get(keyName)));
|
||||
securityKeyValues.get(keyName).addAll(values);
|
||||
securityKeyValues.get(keyName).add(value);
|
||||
}
|
||||
|
||||
return (this);
|
||||
@ -368,16 +367,6 @@ public class QSession implements Serializable
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for securityKeyValues - add 1 value for 1 key.
|
||||
*******************************************************************************/
|
||||
public QSession withSecurityKeyValue(String keyName, Serializable value)
|
||||
{
|
||||
return (withSecurityKeyValues(keyName, List.of(value)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Clear the map of security key values in the session.
|
||||
*******************************************************************************/
|
||||
|
Reference in New Issue
Block a user