Skip to content

Commit

Permalink
added key value shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
melistik committed May 13, 2019
1 parent 94913b1 commit 77772fc
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ public static CommonsPrincipal getCurrent() {
return null;
}

/**
* @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) {
CommonsPrincipal current = getCurrent();
if (current != null) {
return current.getKeyValues() != null ? current.getKeyValues().getOrDefault(key.toLowerCase(), null) : null;
}
return null;
}

@Override
public String getName() {
return getUsername();
Expand Down

0 comments on commit 77772fc

Please sign in to comment.