Security User

Security User gives the information about the currently logged in user, if any.

Version 4.x

Basic Usage

var user = require("security/v4/user");
var response = require("http/v4/response");

response.println("[UserName]: " + user.getName());
response.println("[Is in Role]: " + user.isInRole("Developer"));
response.flush();
response.close();

Definition

Functions


Function Description Returns
getName() Returns the name of the currently logged in user, if any or null string
isInRole(role) Returns true if the user has a given role and false otherwise boolean

Compatibility

Rhino Nashorn V8 Graal

Version 3.x

Basic Usage

var user = require("security/v3/user");
var response = require("http/v3/response");

response.println("[UserName]: " + user.getName());
response.println("[Is in Role]: " + user.isInRole("Developer"));
response.flush();
response.close();

Definition

Functions


Function Description Returns
getName() Returns the name of the currently logged in user, if any or null string
isInRole(role) Returns true if the user has a given role and false otherwise boolean

Compatibility

Rhino Nashorn V8

Edit