Child pages
  • Security
Skip to end of metadata
Go to start of metadata

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

Compare with Current View Page History

« Previous Version 20 Next »

Unknown macro: {div}

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Enter additional information related to this 'class' inside the {div} macro with 'id=description'

Unknown macro: {div}


Unknown macro: {table}
Unknown macro: {tr}
Unknown macro: {th}

Return Types

Unknown macro: {tr}
Unknown macro: {td}


Unknown macro: {table}

{column:width=80px|padding=0px}{column}{column}{column}

Unknown macro: {tr}
Unknown macro: {th}

Constants Summary

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

ACCESSIBLE
Constant representing the accessible flag for form security.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

DELETE
Constant representing the delete flag for table security.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

INSERT
Constant representing the insert flag for table security.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

READ
Constant representing the read flag for table security.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

TRACKING
Constant representing the tracking flag for table security (tracks sql insert/update/delete).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

TRACKING_VIEWS
Constant representing the tracking flag for table security (tracks sql select).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

UPDATE
Constant representing the update flag for table security.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

VIEWABLE
Constant representing the viewable flag for form security.


Unknown macro: {table}

{column:width=80px|padding=0px}{column}{column}{column}

Unknown macro: {tr}
Unknown macro: {th}

Method Summary

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

addUserToGroup(a_userUID, groupName)
Adds an user to a named group.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Object

Unknown macro: {td}

authenticate(authenticator_solution, method)
Authenticate to the Servoy Server using one of the installed authenticators or the Servoy default authenticator.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Object

Unknown macro: {td}

authenticate(authenticator_solution, method, credentials)
Authenticate to the Servoy Server using one of the installed authenticators or the Servoy default authenticator.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

canDelete(dataSource)
Returns a boolean value for security rights.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

canInsert(dataSource)
Returns a boolean value for security rights.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

canRead(dataSource)
Returns a boolean value for security rights.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

canUpdate(dataSource)
Returns a boolean value for security rights.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

changeGroupName(oldGroupName, newGroupName)
Changes the groupname of a group.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

changeUserName(a_userUID, username)
Changes the username of the specified userUID.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

checkPassword(a_userUID, password)
Returns true if the password for that userUID is correct, else false.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

createGroup(groupName)
Creates a group, returns the groupname (or null when group couldn't be created).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Object

Unknown macro: {td}

createUser(username, password)
Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Object

Unknown macro: {td}

createUser(username, password, userUID)
Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

deleteGroup(groupName)
Deletes a group, returns true if no error was reported.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

deleteUser(userUID)
Deletes an user.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

getClientID()
Returns the client ID.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSDataSet

Unknown macro: {td}

getElementUUIDs(formname)
Returns the form elements UUID's as dataset, the one with no name is the form itself.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSDataSet

Unknown macro: {td}

getGroups()
Get all the groups (returns a dataset).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

getSystemUserName()
Retrieves the username of the currently logged in user on operating system level.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSDataSet

Unknown macro: {td}

getUserGroups()
Get all the groups of the current user.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSDataSet

Unknown macro: {td}

getUserGroups(userUID)
Get all the groups for given user UID.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

getUserName()
Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

getUserName(userUID)
Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

getUserUID()
Get the current user UID (null if not logged in); finds the userUID for given user_name if passed as parameter.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

getUserUID(username)
Get the current user UID (null if not logged in); finds the userUID for given user_name if passed as parameter.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSDataSet

Unknown macro: {td}

getUsers()
Get all the users in the security settings (returns a dataset).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSDataSet

Unknown macro: {td}

getUsers(groupName)
Get all the users in the security settings (returns a dataset).

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

isUserMemberOfGroup(groupName)
Check whatever the current user is part of the specified group

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

isUserMemberOfGroup(groupName, userUID)
Check whatever the user specified as parameter is part of the specified group.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

login(username, a_userUID, groups)
Login to be able to leave the solution loginForm.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

void

Unknown macro: {td}

logout()
Logout the current user and close the solution, if the solution requires authentication and user is logged in.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

void

Unknown macro: {td}

logout(solutionToLoad)
Logout the current user and close the solution, if the solution requires authentication and user is logged in.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

void

Unknown macro: {td}

logout(solutionToLoad, method)
Logout the current user and close the solution, if the solution requires authentication and user is logged in.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

void

Unknown macro: {td}

logout(solutionToLoad, method, argument)
Logout the current user and close the solution, if the solution requires authentication and user is logged in.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

removeUserFromGroup(a_userUID, groupName)
Removes an user from a group.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

setPassword(a_userUID, password)
Set a new password for the given userUID.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

void

Unknown macro: {td}

setSecuritySettings(dataset)
Sets the security settings; the entries contained in the given dataset will override those contained in the current security settings.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

setUserUID(a_userUID, newUserUID)
Set a new userUID for the given userUID.


Unknown macro: {table}

{column:width=100%|padding=0px}{column}

Unknown macro: {tr}
Unknown macro: {th}

Constants Details

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
ACCESSIBLE
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the accessible flag for form security.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
DELETE
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the delete flag for table security.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
INSERT
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the insert flag for table security.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
READ
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the read flag for table security.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
TRACKING
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the tracking flag for table security (tracks sql insert/update/delete).

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
TRACKING_VIEWS
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the tracking flag for table security (tracks sql select).

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
UPDATE
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the update flag for table security.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
VIEWABLE
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Constant representing the viewable flag for form security.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}


Unknown macro: {table}

{column:width=100%|padding=0px}{column}

Unknown macro: {tr}
Unknown macro: {th}

Method Details

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
addUserToGroup
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

addUserToGroup

Unknown macro: {span}

(a_userUID, groupName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Adds an user to a named group.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} a_userUID – the user UID to be added
{Object} groupName – the group to add to

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if added

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var userUID = security.getUserUID();
security.addUserToGroup(userUID, 'groupname');
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
authenticate
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Object

Unknown macro: {span}

authenticate

Unknown macro: {span}

(authenticator_solution, method)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Authenticate to the Servoy Server using one of the installed authenticators or the Servoy default authenticator.

Note: this method should be called from a login solution.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} authenticator_solution – authenticator solution installed on the Servoy Server, null for servoy built-in authentication
{String} method – authenticator method, null for servoy built-in authentication

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Object – authentication result from authenticator solution or boolean in case of servoy built-in authentication

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
// create the credentials object as expected by the authenticator solution
var ok =  security.authenticate('myldap_authenticator', 'login', [scopes.globals.userName, scopes.globals.passWord])
if (!ok)
{
	plugins.dialogs.showErrorDialog('Login failed', 'OK')
}

// if no authenticator name is used, the credentials are checked using the Servoy built-in user management
ok = security.authenticate(null, null, [scopes.globals.userName, scopes.globals.passWord])
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
authenticate
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Object

Unknown macro: {span}

authenticate

Unknown macro: {span}

(authenticator_solution, method, credentials)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Authenticate to the Servoy Server using one of the installed authenticators or the Servoy default authenticator.

Note: this method should be called from a login solution, once logged in, the authenticate method has no effect.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} authenticator_solution – authenticator solution installed on the Servoy Server, null for servoy built-in authentication
{String} method – authenticator method, null for servoy built-in authentication
{Object[]} credentials – array whose elements are passed as arguments to the authenticator method, in case of servoy built-in authentication this should be [username, password]

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Object – authentication result from authenticator solution or boolean in case of servoy built-in authentication

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
// create the credentials object as expected by the authenticator solution
var ok =  security.authenticate('myldap_authenticator', 'login', [scopes.globals.userName, scopes.globals.passWord])
if (!ok)
{
	plugins.dialogs.showErrorDialog('Login failed', 'OK')
}

// if no authenticator name is used, the credentials are checked using the Servoy built-in user management
ok = security.authenticate(null, null, [scopes.globals.userName, scopes.globals.passWord])
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
canDelete
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

canDelete

Unknown macro: {span}

(dataSource)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Returns a boolean value for security rights.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} dataSource – the datasource

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if allowed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var dataSource = controller.getDataSource();
var canDelete = security.canDelete(dataSource);
var canInsert = security.canInsert(dataSource);
var canUpdate = security.canUpdate(dataSource);
var canRead = security.canRead(dataSource);
application.output("Can delete? " + canDelete);
application.output("Can insert? " + canInsert);
application.output("Can update? " + canUpdate);
application.output("Can read? " + canRead);
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
canInsert
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

canInsert

Unknown macro: {span}

(dataSource)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Returns a boolean value for security rights.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} dataSource – the datasource

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if allowed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var dataSource = controller.getDataSource();
var canDelete = security.canDelete(dataSource);
var canInsert = security.canInsert(dataSource);
var canUpdate = security.canUpdate(dataSource);
var canRead = security.canRead(dataSource);
application.output("Can delete? " + canDelete);
application.output("Can insert? " + canInsert);
application.output("Can update? " + canUpdate);
application.output("Can read? " + canRead);
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
canRead
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

canRead

Unknown macro: {span}

(dataSource)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Returns a boolean value for security rights.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} dataSource – the datasource

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if allowed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var dataSource = controller.getDataSource();
var canDelete = security.canDelete(dataSource);
var canInsert = security.canInsert(dataSource);
var canUpdate = security.canUpdate(dataSource);
var canRead = security.canRead(dataSource);
application.output("Can delete? " + canDelete);
application.output("Can insert? " + canInsert);
application.output("Can update? " + canUpdate);
application.output("Can read? " + canRead);
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
canUpdate
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

canUpdate

Unknown macro: {span}

(dataSource)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Returns a boolean value for security rights.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} dataSource – the datasource

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if allowed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var dataSource = controller.getDataSource();
var canDelete = security.canDelete(dataSource);
var canInsert = security.canInsert(dataSource);
var canUpdate = security.canUpdate(dataSource);
var canRead = security.canRead(dataSource);
application.output("Can delete? " + canDelete);
application.output("Can insert? " + canInsert);
application.output("Can update? " + canUpdate);
application.output("Can read? " + canRead);
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
changeGroupName
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

changeGroupName

Unknown macro: {span}

(oldGroupName, newGroupName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Changes the groupname of a group.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} oldGroupName – the old name
{String} newGroupName – the new name

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if changed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
security.changeGroupName('oldGroup', 'newGroup');
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
changeUserName
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

changeUserName

Unknown macro: {span}

(a_userUID, username)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Changes the username of the specified userUID.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} a_userUID – the userUID to work on
{String} username – the new username

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if changed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
if(security.changeUserName(security.getUserUID('name1'), 'name2'))
{
	application.output('Username changed');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
checkPassword
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

checkPassword

Unknown macro: {span}

(a_userUID, password)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Returns true if the password for that userUID is correct, else false.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} a_userUID – the userUID to check the password for
{String} password – the new password

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if password oke

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
if(security.checkPassword(security.getUserUID(), 'password1'))
{
	security.setPassword(security.getUserUID(), 'password2')
}
else
{
	application.output('wrong password')
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
createGroup
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

createGroup

Unknown macro: {span}

(groupName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Creates a group, returns the groupname (or null when group couldn't be created).

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} groupName – the group name to create

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String – the created groupname

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var deleteGroup = true;
//ceate a group
var groupName = security.creategroup('myGroup');
if (groupName)
{
	//create a user
	var uid = security.createUser('myusername', 'mypassword');
	if (uid) //test if user was created
	{
		//set a newUID for the user
		var isChanged = security.setUserUID(uid,'myUserUID')
		// add user to group
		security.addUserToGroup(uid, groupName);
		// if not delete group, do delete group
		if (deleteGroup) 
		{
			security.deleteGroup(groupName);
		}
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
createUser
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Object

Unknown macro: {span}

createUser

Unknown macro: {span}

(username, password)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist).

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} username – the username
{String} password – the user password

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Object – the userUID the created userUID, will be same if provided

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var removeUser = true;
//create a user
var uid = security.createUser('myusername', 'mypassword');
if (uid) //test if user was created
{
	// Get all the groups
	var set = security.getGroups();
	for(var p = 1 ; p <= set.getMaxRowIndex() ; p++)
	{
		// output name of the group
		application.output(set.getValue(p, 2));
		// add user to group
		security.addUserToGroup(uid, set.getValue(p,2));
	}
	// if not remove user, remove user from all the groups
	if(!removeUser)
	{
		// get now all the groups that that users has (all if above did go well)
		var set =security.getUserGroups(uid);
		for(var p = 1;p<=set.getMaxRowIndex();p++)
		{
			// output name of the group
			application.output(set.getValue(p, 2));
			// remove the user from the group
			security.removeUserFromGroup(uid, set.getValue(p,2));
		}
	}
	else
	{
		// delete the user (the user will be removed from the groups)
		security.deleteUser(uid);
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
createUser
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Object

Unknown macro: {span}

createUser

Unknown macro: {span}

(username, password, userUID)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist).

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} username – the username
{String} password – the user password
{Object} userUID – the user UID to use

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Object – the userUID the created userUID, will be same if provided

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var removeUser = true;
//create a user
var uid = security.createUser('myusername', 'mypassword');
if (uid) //test if user was created
{
	// Get all the groups
	var set = security.getGroups();
	for(var p = 1 ; p <= set.getMaxRowIndex() ; p++)
	{
		// output name of the group
		application.output(set.getValue(p, 2));
		// add user to group
		security.addUserToGroup(uid, set.getValue(p,2));
	}
	// if not remove user, remove user from all the groups
	if(!removeUser)
	{
		// get now all the groups that that users has (all if above did go well)
		var set =security.getUserGroups(uid);
		for(var p = 1;p<=set.getMaxRowIndex();p++)
		{
			// output name of the group
			application.output(set.getValue(p, 2));
			// remove the user from the group
			security.removeUserFromGroup(uid, set.getValue(p,2));
		}
	}
	else
	{
		// delete the user (the user will be removed from the groups)
		security.deleteUser(uid);
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
deleteGroup
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

deleteGroup

Unknown macro: {span}

(groupName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Deletes a group, returns true if no error was reported.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} groupName – the name of the group to delete

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if deleted

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var deleteGroup = true;
//ceate a group
var groupName = security.creategroup('myGroup');
if (groupName)
{
	//create a user
	var uid = security.createUser('myusername', 'mypassword');
	if (uid) //test if user was created
	{
		//set a newUID for the user
		var isChanged = security.setUserUID(uid,'myUserUID')
		// add user to group
		security.addUserToGroup(uid, groupName);
		// if not delete group, do delete group
		if (deleteGroup) 
		{
			security.deleteGroup(groupName);
		}
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
deleteUser
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

deleteUser

Unknown macro: {span}

(userUID)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Deletes an user. returns true if no error was reported.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} userUID – The UID of the user to be deleted.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if the user is successfully deleted.

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var removeUser = true;
//create a user
var uid = security.createUser('myusername', 'mypassword');
if (uid) //test if user was created
{
	// Get all the groups
	var set = security.getGroups();
	for(var p = 1 ; p <= set.getMaxRowIndex() ; p++)
	{
		// output name of the group
		application.output(set.getValue(p, 2));
		// add user to group
		security.addUserToGroup(uid, set.getValue(p,2));
	}
	// if not remove user, remove user from all the groups
	if(!removeUser)
	{
		// get now all the groups that that users has (all if above did go well)
		var set =security.getUserGroups(uid);
		for(var p = 1;p<=set.getMaxRowIndex();p++)
		{
			// output name of the group
			application.output(set.getValue(p, 2));
			// remove the user from the group
			security.removeUserFromGroup(uid, set.getValue(p,2));
		}
	}
	else
	{
		// delete the user (the user will be removed from the groups)
		security.deleteUser(uid);
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getClientID
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getClientID

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Returns the client ID.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String – the clientId as seen on the server admin page

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var clientId = security.getClientID()
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getElementUUIDs
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSDataSet

Unknown macro: {span}

getElementUUIDs

Unknown macro: {span}

(formname)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Returns the form elements UUID's as dataset, the one with no name is the form itself.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} formname – the formname to retieve the dataset for

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSDataSet – dataset with element info

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var formElementsUUIDDataSet = security.getElementUUIDs('orders_form');
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getGroups
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSDataSet

Unknown macro: {span}

getGroups

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get all the groups (returns a dataset).
first id column is deprecated!, use only the group name column.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSDataSet – dataset with all the groups

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var removeUser = true;
//create a user
var uid = security.createUser('myusername', 'mypassword');
if (uid) //test if user was created
{
	// Get all the groups
	var set = security.getGroups();
	for(var p = 1 ; p <= set.getMaxRowIndex() ; p++)
	{
		// output name of the group
		application.output(set.getValue(p, 2));
		// add user to group
		security.addUserToGroup(uid, set.getValue(p,2));
	}
	// if not remove user, remove user from all the groups
	if(!removeUser)
	{
		// get now all the groups that that users has (all if above did go well)
		var set =security.getUserGroups(uid);
		for(var p = 1;p<=set.getMaxRowIndex();p++)
		{
			// output name of the group
			application.output(set.getValue(p, 2));
			// remove the user from the group
			security.removeUserFromGroup(uid, set.getValue(p,2));
		}
	}
	else
	{
		// delete the user (the user will be removed from the groups)
		security.deleteUser(uid);
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getSystemUserName
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getSystemUserName

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Retrieves the username of the currently logged in user on operating system level.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String – the os user name

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//gets the current os username
var osUserName = security.getSystemUserName();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUserGroups
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSDataSet

Unknown macro: {span}

getUserGroups

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get all the groups of the current user.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSDataSet – dataset with groupnames

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//get all the users in the security settings (Returns a JSDataset)
var dsUsers = security.getUsers()

//loop through each user to get their group
//The getValue call is (row,column) where column 1 == id and 2 == name
for(var i=1 ; i<=dsUsers.getMaxRowIndex() ; i++)
{
	//print to the output debugger tab: "user: " and the username
	application.output("user:" + dsUsers.getValue(i,2));

	//set p to the user group for the current user
	/** @type {JSDataSet} */
	var p = security.getUserGroups(dsUsers.getValue(i,1));

	for(k=1;k<=p.getMaxRowIndex();k++)
	{
		//print to the output debugger tab: "group" and the group(s)
		//the user belongs to
		application.output("group: " + p.getValue(k,2));
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUserGroups
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSDataSet

Unknown macro: {span}

getUserGroups

Unknown macro: {span}

(userUID)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get all the groups for given user UID.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} userUID – to retrieve the user groups

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSDataSet – dataset with groupnames

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//get all the users in the security settings (Returns a JSDataset)
var dsUsers = security.getUsers()

//loop through each user to get their group
//The getValue call is (row,column) where column 1 == id and 2 == name
for(var i=1 ; i<=dsUsers.getMaxRowIndex() ; i++)
{
	//print to the output debugger tab: "user: " and the username
	application.output("user:" + dsUsers.getValue(i,2));

	//set p to the user group for the current user
	/** @type {JSDataSet} */
	var p = security.getUserGroups(dsUsers.getValue(i,1));

	for(k=1;k<=p.getMaxRowIndex();k++)
	{
		//print to the output debugger tab: "group" and the group(s)
		//the user belongs to
		application.output("group: " + p.getValue(k,2));
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUserName
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getUserName

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String – the user name

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//gets the current loggedIn username
var userName = security.getUserName();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUserName
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getUserName

Unknown macro: {span}

(userUID)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} userUID – the user UID used to retrieve the name

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String – the user name

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//gets the current loggedIn username
var userName = security.getUserName();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUserUID
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getUserUID

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get the current user UID (null if not logged in); finds the userUID for given user_name if passed as parameter.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String – the userUID

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//gets the current loggedIn username
var userName = security.getUserName(); 
//gets the uid of the given username
var userUID = security.getUserUID(userName);
//is the same as above 
//var my_userUID = security.getUserUID();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUserUID
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getUserUID

Unknown macro: {span}

(username)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get the current user UID (null if not logged in); finds the userUID for given user_name if passed as parameter.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} username – the username to find the userUID for

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String – the userUID

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//gets the current loggedIn username
var userName = security.getUserName(); 
//gets the uid of the given username
var userUID = security.getUserUID(userName);
//is the same as above 
//var my_userUID = security.getUserUID();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUsers
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSDataSet

Unknown macro: {span}

getUsers

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get all the users in the security settings (returns a dataset).

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSDataSet – dataset with all the users

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//get all the users in the security settings (Returns a JSDataset)
var dsUsers = security.getUsers()

//loop through each user to get their group
//The getValue call is (row,column) where column 1 == id and 2 == name
for(var i=1 ; i<=dsUsers.getMaxRowIndex() ; i++)
{
	//print to the output debugger tab: "user: " and the username
	application.output("user:" + dsUsers.getValue(i,2));

	//set p to the user group for the current user
	/** @type {JSDataSet} */
	var p = security.getUserGroups(dsUsers.getValue(i,1));

	for(k=1;k<=p.getMaxRowIndex();k++)
	{
		//print to the output debugger tab: "group" and the group(s)
		//the user belongs to
		application.output("group: " + p.getValue(k,2));
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getUsers
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSDataSet

Unknown macro: {span}

getUsers

Unknown macro: {span}

(groupName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Get all the users in the security settings (returns a dataset).

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} groupName – the group to filter on

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSDataSet – dataset with all the users

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//get all the users in the security settings (Returns a JSDataset)
var dsUsers = security.getUsers()

//loop through each user to get their group
//The getValue call is (row,column) where column 1 == id and 2 == name
for(var i=1 ; i<=dsUsers.getMaxRowIndex() ; i++)
{
	//print to the output debugger tab: "user: " and the username
	application.output("user:" + dsUsers.getValue(i,2));

	//set p to the user group for the current user
	/** @type {JSDataSet} */
	var p = security.getUserGroups(dsUsers.getValue(i,1));

	for(k=1;k<=p.getMaxRowIndex();k++)
	{
		//print to the output debugger tab: "group" and the group(s)
		//the user belongs to
		application.output("group: " + p.getValue(k,2));
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
isUserMemberOfGroup
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

isUserMemberOfGroup

Unknown macro: {span}

(groupName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Check whatever the current user is part of the specified group

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} groupName – name of the group to check

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – dataset with groupnames

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//check whatever user is part of the Administrators group
if(security.isUserMemberOfGroup('Administrators', security.getUserUID('admin')))
{
	// do administration stuff
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
isUserMemberOfGroup
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

isUserMemberOfGroup

Unknown macro: {span}

(groupName, userUID)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Check whatever the user specified as parameter is part of the specified group.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} groupName – name of the group to check
{Object} userUID – UID of the user to check

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – dataset with groupnames

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//check whatever user is part of the Administrators group
if(security.isUserMemberOfGroup('Administrators', security.getUserUID('admin')))
{
	// do administration stuff
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
login
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

login

Unknown macro: {span}

(username, a_userUID, groups)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Login to be able to leave the solution loginForm.

Example: Group names may be received from LDAP (Lightweight Directory Access Protocol) - a standard protocol used in web browsers and email applications to enable lookup queries that access a directory listing.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} username – the username, like 'JamesWebb'
{Object} a_userUID – the user UID to process login for
{String[]} groups – the groups array

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if loggedin

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var groups = ['Administrators']; //normally these groups are for example received from LDAP
var user_uid = scopes.globals.email; //also this uid might be received from external authentication method
var ok =  security.login(scopes.globals.username, user_uid , groups)
if (!ok)
{
	plugins.dialogs.showErrorDialog('Login failure',  'Already logged in? or no user_uid/groups specified?', 'OK')
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
logout
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

void

Unknown macro: {span}

logout

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Logout the current user and close the solution, if the solution requires authentication and user is logged in.
You can redirect to another solution if needed; if you want to go to a different url, you need to call application.showURL(url) before calling security.logout() (this is only applicable for Web Client).
An alternative option to close a solution and to open another solution, while keeping the user logged in, is application.closeSolution().

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

void

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//Set the url to go to after logout.
//application.showURL('http://www.servoy.com', '_self');  //Web Client only
security.logout();
//security.logout('solution_name');//log out and close current solution and open solution 'solution_name'
//security.logout('solution_name','global_method_name');//log out, close current solution, open solution 'solution_name' and call global method 'global_method_name' of the newly opened solution
//security.logout('solution_name','global_method_name','my_string_argument');//log out, close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'
//security.logout('solution_name','global_second_method_name',2);
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
logout
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

void

Unknown macro: {span}

logout

Unknown macro: {span}

(solutionToLoad)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Logout the current user and close the solution, if the solution requires authentication and user is logged in.
You can redirect to another solution if needed; if you want to go to a different url, you need to call application.showURL(url) before calling security.logout() (this is only applicable for Web Client).
An alternative option to close a solution and to open another solution, while keeping the user logged in, is application.closeSolution().

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} solutionToLoad – the solution to load after logout

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

void

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//Set the url to go to after logout.
//application.showURL('http://www.servoy.com', '_self');  //Web Client only
security.logout();
//security.logout('solution_name');//log out and close current solution and open solution 'solution_name'
//security.logout('solution_name','global_method_name');//log out, close current solution, open solution 'solution_name' and call global method 'global_method_name' of the newly opened solution
//security.logout('solution_name','global_method_name','my_string_argument');//log out, close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'
//security.logout('solution_name','global_second_method_name',2);
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
logout
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

void

Unknown macro: {span}

logout

Unknown macro: {span}

(solutionToLoad, method)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Logout the current user and close the solution, if the solution requires authentication and user is logged in.
You can redirect to another solution if needed; if you want to go to a different url, you need to call application.showURL(url) before calling security.logout() (this is only applicable for Web Client).
An alternative option to close a solution and to open another solution, while keeping the user logged in, is application.closeSolution().

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} solutionToLoad – the solution to load after logout
{String} method – the method to run in the solution to load

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

void

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//Set the url to go to after logout.
//application.showURL('http://www.servoy.com', '_self');  //Web Client only
security.logout();
//security.logout('solution_name');//log out and close current solution and open solution 'solution_name'
//security.logout('solution_name','global_method_name');//log out, close current solution, open solution 'solution_name' and call global method 'global_method_name' of the newly opened solution
//security.logout('solution_name','global_method_name','my_string_argument');//log out, close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'
//security.logout('solution_name','global_second_method_name',2);
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
logout
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

void

Unknown macro: {span}

logout

Unknown macro: {span}

(solutionToLoad, method, argument)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Logout the current user and close the solution, if the solution requires authentication and user is logged in.
You can redirect to another solution if needed; if you want to go to a different url, you need to call application.showURL(url) before calling security.logout() (this is only applicable for Web Client).
An alternative option to close a solution and to open another solution, while keeping the user logged in, is application.closeSolution().

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{String} solutionToLoad – the solution to load after logout
{String} method – the method to run in the solution to load
{Object} argument – the argument to pass to the method to run

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

void

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
//Set the url to go to after logout.
//application.showURL('http://www.servoy.com', '_self');  //Web Client only
security.logout();
//security.logout('solution_name');//log out and close current solution and open solution 'solution_name'
//security.logout('solution_name','global_method_name');//log out, close current solution, open solution 'solution_name' and call global method 'global_method_name' of the newly opened solution
//security.logout('solution_name','global_method_name','my_string_argument');//log out, close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'
//security.logout('solution_name','global_second_method_name',2);
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
removeUserFromGroup
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

removeUserFromGroup

Unknown macro: {span}

(a_userUID, groupName)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Removes an user from a group.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} a_userUID – the user UID to be removed
{Object} groupName – the group to remove from

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if removed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var removeUser = true;
//create a user
var uid = security.createUser('myusername', 'mypassword');
if (uid) //test if user was created
{
	// Get all the groups
	var set = security.getGroups();
	for(var p = 1 ; p <= set.getMaxRowIndex() ; p++)
	{
		// output name of the group
		application.output(set.getValue(p, 2));
		// add user to group
		security.addUserToGroup(uid, set.getValue(p,2));
	}
	// if not remove user, remove user from all the groups
	if(!removeUser)
	{
		// get now all the groups that that users has (all if above did go well)
		var set =security.getUserGroups(uid);
		for(var p = 1;p<=set.getMaxRowIndex();p++)
		{
			// output name of the group
			application.output(set.getValue(p, 2));
			// remove the user from the group
			security.removeUserFromGroup(uid, set.getValue(p,2));
		}
	}
	else
	{
		// delete the user (the user will be removed from the groups)
		security.deleteUser(uid);
	}
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
setPassword
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

setPassword

Unknown macro: {span}

(a_userUID, password)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Set a new password for the given userUID.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} a_userUID – the userUID to set the new password for
{String} password – the new password

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if changed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
if(security.checkPassword(security.getUserUID(), 'password1'))
{
	security.setPassword(security.getUserUID(), 'password2')
}
else
{
	application.output('wrong password')
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
setSecuritySettings
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

void

Unknown macro: {span}

setSecuritySettings

Unknown macro: {span}

(dataset)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Sets the security settings; the entries contained in the given dataset will override those contained in the current security settings.

NOTE: The security.getElementUUIDs and security.setSecuritySettings functions can be used to define custom security that overrides Servoy security.
For additional information see the function security.getElementUUIDs.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} dataset – the dataset with security settings

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

void

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var colNames = new Array();
colNames[0] = 'uuid';
colNames[1] = 'flags';
var dataset = databaseManager.createEmptyDataSet(0,colNames);

var row = new Array();
row[0] = '413a4d69-becb-4ae4-8fdd-980755d6a7fb';//normally retreived via security.getElementUUIDs(...)
row[1] = JSSecurity.VIEWABLE|JSSecurity.ACCESSIBLE; // use bitwise 'or' for both
dataset.addRow(row);//setting element security

row = new Array();
row[0] = 'example_data.orders';
row[1] = JSSecurity.READ|JSSecurity.INSERT|JSSecurity.UPDATE|JSSecurity.DELETE|JSSecurity.TRACKING; //use bitwise 'or' for multiple flags
dataset.addRow(row);//setting table security

security.setSecuritySettings(dataset);//to be called in solution startup method
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
setUserUID
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

setUserUID

Unknown macro: {span}

(a_userUID, newUserUID)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Set a new userUID for the given userUID.

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} a_userUID – the userUID to set the new user UID for
{String} newUserUID – the new user UID

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if changed

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var deleteGroup = true;
//ceate a group
var groupName = security.creategroup('myGroup');
if (groupName)
{
	//create a user
	var uid = security.createUser('myusername', 'mypassword');
	if (uid) //test if user was created
	{
		//set a newUID for the user
		var isChanged = security.setUserUID(uid,'myUserUID')
		// add user to group
		security.addUserToGroup(uid, groupName);
		// if not delete group, do delete group
		if (deleteGroup) 
		{
			security.deleteGroup(groupName);
		}
	}
}
Unknown macro: {tr}
Unknown macro: {td}
  • No labels