Skip to content

Commit

Permalink
little fixes regarding keyValues
Browse files Browse the repository at this point in the history
  • Loading branch information
melistik committed May 14, 2019
1 parent 77772fc commit bafa60f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static CommonsPrincipal getCurrent() {
* @return the value of the given key when user is logged in and key exists<br>
* key is stored internally in lowercase so that this function also lowers the given key...
*/
public String getCurrentKeyValue(String key) {
public static String getCurrentKeyValue(String key) {
CommonsPrincipal current = getCurrent();
if (current != null) {
return current.getKeyValues() != null ? current.getKeyValues().getOrDefault(key.toLowerCase(), null) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,11 @@ public AppUserReference toReference() {
.build();
}

public boolean hasKeyValue(String key) {
return keyValues != null && key != null && keyValues.containsKey(key.toLowerCase());
}

public String getKeyValue(String key) {
return keyValues != null && key != null ? keyValues.getOrDefault(key.toLowerCase() , null) : null;
}
}

0 comments on commit bafa60f

Please sign in to comment.