You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »


getContext()



Return:

Type

Description

SimpleRecord objectThis method returns the current attribute object.

Example:

getContext
const record = new SimpleUser();
let user = record.getContext(); //user or employee attributes
ss.info(record.hasRole('admin')); //true | false
ss.info("Does this user have the security admin role? " + record.hasRole('security_admin')); // true | false
ss.info("Is the navigator menu pinned? " + record.getPreference('menu.pin')); // -1 / 0 / 1
record.setPreference('New user preference', 'Menu pinning'); 
ss.info("New preference value: " + record.getPreference('New user preference')); //Menu pinning
ss.info("not existing preference: " + record.getPreference('non-existing preference')); //null
ss.info(user.username);  //admin

getID()



Return:

TypeDescription
StringCurrent user ID.
getID

getPreference(preferenceName)


Parameter(s):

NameTypeMandatoryDefault Value
preferenceNameStringYN

Return:

TypeDescription
StringThis method returns the specified preference value for the current user. If the specified preference does not exist, it returns NULL.
getPreference

hasRole(role)


Parameter(s):

NameTypeMandatoryDefault Value
roleStringYN

Return:

TypeDescription
BooleanThis method approves or disproves an assumption whether a specified user is granted with a specified role.
hasRole

setPreference(preferenceName, value)


Parameter(s):

NameTypeMandatoryDefault Value
preferenceNameStringYN
valueStringYN

Return:

TypeDescription
VoidThis method does not return a value.
setPreference

  • No labels