Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
Table Body (tbody) |
---|
id | addUserToGroup-Object_Object |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
addUserToGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
(a_userUID, groupName) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Adds an user to a named group. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} a_userUID – the user UID to be added {Object} groupName – the group to add to |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var userUID = security.getUserUID();
security.addUserToGroup(userUID, 'groupname');
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | authenticate-String_String |
---|
| }{:=}{td}h6.authenticate{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
authenticate |
|
| }[]{span}{span:style= }{span}{span}\ Span |
---|
(authenticator_solution, |
|
|
| {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[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
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object] -- authentication result from authenticator solution or boolean in case of servoy built-in authentication{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
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. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
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 |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Object – authentication result from authenticator solution or boolean in case of servoy built-in authentication |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// 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])
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | authenticate-String_String_ObjectArray |
---|
| }{:=}{td}h6.authenticate{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
authenticate |
|
| }[]{span}{span:style= }{span}{span}\ Span |
---|
(authenticator_solution, |
|
|
| {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[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\]
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object] -- authentication result from authenticator solution or boolean in case of servoy built-in authentication{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
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. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
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] |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Object – authentication result from authenticator solution or boolean in case of servoy built-in authentication |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// 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])
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=canDelete-String}{tr:id=name}{td}h6.canDelete{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}canDelete{span}{span}\(dataSource){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a boolean value for security rights.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- the datasource
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if allowed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns a boolean value for security rights. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} dataSource – the datasource |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=canInsert-String}{tr:id=name}{td}h6.canInsert{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}canInsert{span}{span}\(dataSource){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a boolean value for security rights.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- the datasource
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if allowed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns a boolean value for security rights. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} dataSource – the datasource |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=canRead-String}{tr:id=name}{td}h6.canRead{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}canRead{span}{span}\(dataSource){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a boolean value for security rights.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- the datasource
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if allowed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns a boolean value for security rights. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} dataSource – the datasource |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=canUpdate-String}{tr:id=name}{td}h6.canUpdate{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}canUpdate{span}{span}\(dataSource){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a boolean value for security rights.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- the datasource
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if allowed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns a boolean value for security rights. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} dataSource – the datasource |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | changeGroupName-Object_String |
---|
| }{:=}{td}h6.changeGroupName{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
changeGroupName |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Changes the groupname of a group.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} oldGroupName -- the old name
\{[String]} newGroupName -- the new name
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if changed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Changes the groupname of a group. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} oldGroupName – the old name {String} newGroupName – the new name |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
security.changeGroupName('oldGroup', 'newGroup');
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | changeUserName-Object_String |
---|
| }{:=}{td}h6.changeUserName{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
changeUserName |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Changes the username of the specified userUID.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} a_userUID -- the userUID to work on
\{[String]} username -- the new username
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if changed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Changes the username of the specified userUID. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} a_userUID – the userUID to work on {String} username – the new username |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
if(security.changeUserName(security.getUserUID('name1'), 'name2'))
{
application.output('Username changed');
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | checkPassword-Object_String |
---|
| }{:=}{td}h6.checkPassword{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
checkPassword |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns true if the password for that userUID is correct, else false.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} a_userUID -- the userUID to check the password for
\{[String]} password -- the new password
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if password oke{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns true if the password for that userUID is correct, else false. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} a_userUID – the userUID to check the password for {String} password – the new password |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
if(security.checkPassword(security.getUserUID(), 'password1'))
{
security.setPassword(security.getUserUID(), 'password2')
}
else
{
application.output('wrong password')
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=createGroup-String}{tr:id=name}{td}h6.createGroup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}createGroup{span}{span}\(groupName){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Creates a group, returns the groupname (or null when group couldn't be created).{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} groupName -- the group name to create
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the created groupname{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a group, returns the groupname (or null when group couldn't be created). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} groupName – the group name to create |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String – the created groupname |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | createUser-String_String |
---|
| }{:=}{td}h6.createUser{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
createUser |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist).{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} username -- the username
\{[String]} password -- the user password
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object] -- the userUID the created userUID, will be same if provided{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} username – the username {String} password – the user password |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Object – the userUID the created userUID, will be same if provided |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | createUser-String_String_Object |
---|
| }{:=}{td}h6.createUser{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
createUser |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist).{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} username -- the username
\{[String]} password -- the user password
\{[Object]} userUID -- the user UID to use
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object] -- the userUID the created userUID, will be same if provided{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} username – the username {String} password – the user password {Object} userUID – the user UID to use |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Object – the userUID the created userUID, will be same if provided |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteGroup-Object}{tr:id=name}{td}h6.deleteGroup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}deleteGroup{span}{span}\(groupName){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Deletes a group, returns true if no error was reported.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} groupName -- the name of the group to delete
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if deleted{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
deleteGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Deletes a group, returns true if no error was reported. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} groupName – the name of the group to delete |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteUser-Object}{tr:id=name}{td}h6.deleteUser{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}deleteUser{span}{span}\(userUID){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Deletes an user. returns true if no error was reported.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} userUID -- The UID of the user to be deleted.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if the user is successfully deleted.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
deleteUser |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Deletes an user. returns true if no error was reported. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} userUID – The UID of the user to be deleted. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Boolean – true if the user is successfully deleted. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getClientID}{tr:id=name}{td}h6.getClientID{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getClientID{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the client ID.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the clientId as seen on the server admin page{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getClientID |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the client ID. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String – the clientId as seen on the server admin page |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var clientId = security.getClientID()
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getElementUUIDs-String}{tr:id=name}{td}h6.getElementUUIDs{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSDataSet]{span}{span:style=font-weight: bold;}getElementUUIDs{span}{span}\(formname){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the form elements UUID's as dataset, the one with no name is the form itself.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} formname -- the formname to retieve the dataset for
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSDataSet] -- dataset with element info{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getElementUUIDs |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the form elements UUID's as dataset, the one with no name is the form itself. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} formname – the formname to retieve the dataset for |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var formElementsUUIDDataSet = security.getElementUUIDs('orders_form' |
|
|
|
| );
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getGroups}{tr:id=name}{td}h6.getGroups{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSDataSet]{span}{span:style=font-weight: bold;}getGroups{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get all the groups (returns a dataset).
first id column is deprecated!, use only the group name column.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSDataSet] -- dataset with all the groups{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get all the groups (returns a dataset). first id column is deprecated!, use only the group name column. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getSystemUserName}{tr:id=name}{td}h6.getSystemUserName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getSystemUserName{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Retrieves the username of the currently logged in user on operating system level.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the os user name{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getSystemUserName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Retrieves the username of the currently logged in user on operating system level. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//gets the current os username
var osUserName = security.getSystemUserName() |
|
|
|
| ;
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserGroups}{tr:id=name}{td}h6.getUserGroups{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSDataSet]{span}{span:style=font-weight: bold;}getUserGroups{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get all the groups of the current user.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSDataSet] -- dataset with groupnames{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserGroups |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get all the groups of the current user. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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));
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserGroups-Object}{tr:id=name}{td}h6.getUserGroups{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSDataSet]{span}{span:style=font-weight: bold;}getUserGroups{span}{span}\(userUID){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get all the groups for given user UID.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} userUID -- to retrieve the user groups
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSDataSet] -- dataset with groupnames{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserGroups |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get all the groups for given user UID. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} userUID – to retrieve the user groups |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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));
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserName}{tr:id=name}{td}h6.getUserName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getUserName{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the user name{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//gets the current loggedIn username
var userName = security.getUserName();
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserName-Object}{tr:id=name}{td}h6.getUserName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getUserName{span}{span}\(userUID){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} userUID -- the user UID used to retrieve the name
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the user name{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} userUID – the user UID used to retrieve the name |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//gets the current loggedIn username
var userName = security.getUserName();
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserUID}{tr:id=name}{td}h6.getUserUID{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getUserUID{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the current user UID (null if not logged in); finds the userUID for given user\_name if passed as parameter.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the userUID{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserUID |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get the current user UID (null if not logged in); finds the userUID for given user_name if passed as parameter. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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 |
|
|
|
| ();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserUID-String}{tr:id=name}{td}h6.getUserUID{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getUserUID{span}{span}\(username){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the current user UID (null if not logged in); finds the userUID for given user\_name if passed as parameter.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} username -- the username to find the userUID for
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the userUID{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserUID |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get the current user UID (null if not logged in); finds the userUID for given user_name if passed as parameter. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} username – the username to find the userUID for |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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();
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUsers}{tr:id=name}{td}h6.getUsers{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSDataSet]{span}{span:style=font-weight: bold;}getUsers{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get all the users in the security settings (returns a dataset).{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSDataSet] -- dataset with all the users{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get all the users in the security settings (returns a dataset). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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));
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUsers-String}{tr:id=name}{td}h6.getUsers{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSDataSet]{span}{span:style=font-weight: bold;}getUsers{span}{span}\(groupName){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get all the users in the security settings (returns a dataset).{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} groupName -- the group to filter on
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSDataSet] -- dataset with all the users{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get all the users in the security settings (returns a dataset). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} groupName – the group to filter on |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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));
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=isUserMemberOfGroup-String}{tr:id=name}{td}h6.isUserMemberOfGroup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}isUserMemberOfGroup{span}{span}\(groupName){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Check whatever the current user is part of the specified group{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} groupName -- name of the group to check
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- dataset with groupnames{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | isUserMemberOfGroup-String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
isUserMemberOfGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Check whatever the current user is part of the specified group |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} groupName – name of the group to check |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Boolean – dataset with groupnames |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//check whatever user is part of the Administrators group
if(security.isUserMemberOfGroup('Administrators', security.getUserUID('admin')))
{
// do administration stuff
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | isUserMemberOfGroup-String_Object |
---|
| }{:=}{td}h6.isUserMemberOfGroup{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
isUserMemberOfGroup |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Check whatever the user specified as parameter is part of the specified group.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} groupName -- name of the group to check
\{[Object]} userUID -- UID of the user to check
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- dataset with groupnames{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Check whatever the user specified as parameter is part of the specified group. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} groupName – name of the group to check {Object} userUID – UID of the user to check |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Boolean – dataset with groupnames |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//check whatever user is part of the Administrators group
if(security.isUserMemberOfGroup('Administrators', security.getUserUID('admin')))
{
// do administration stuff
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | login-String_Object_StringArray |
---|
| }{:=}{td}h6.login{td}{tr}{tr:id=sig}{td}{span:style= }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} username -- the username, like 'JamesWebb'
\{[Object]} a_userUID -- the user UID to process login for
\{[String]\[]} groups -- the groups array
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if loggedin{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
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. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} username – the username, like 'JamesWebb' {Object} a_userUID – the user UID to process login for {String[]} groups – the groups array |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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' |
|
|
|
| )
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=logout}{tr:id=name}{td}h6.logout{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}logout{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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 Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
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) |
|
|
|
application.closeSolution(). |
|
|
| {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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 )
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=logout-String}{tr:id=name}{td}h6.logout{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}logout{span}{span}\(solutionToLoad){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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 Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
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) |
|
|
|
application.closeSolution(). |
|
|
| {div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} solutionToLoad -- the solution to load after logout
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} solutionToLoad – the solution to load after logout |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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 )
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=}{:=}{td}h6.logout{td}{tr}{tr:id=sig}{td}{span:style= }{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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 Table Row (tr) |
---|
| Table Cell (td) |
---|
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) |
|
|
|
application.closeSolution(). |
|
|
| {div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} solutionToLoad -- the solution to load after logout
\{[String]} method -- the method to run in the solution to load
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} solutionToLoad – the solution to load after logout {String} method – the method to run in the solution to load |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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 )
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | logout-String_String_Object |
---|
| }{:=}{td}h6.logout{td}{tr}{tr:id=sig}{td}{span:style= }{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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 Table Row (tr) |
---|
| Table Cell (td) |
---|
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) |
|
|
|
application.closeSolution(). |
|
|
| {div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[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
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
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 |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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 )
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | removeUserFromGroup-Object_Object |
---|
| }{:=}{td}h6.removeUserFromGroup{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
removeUserFromGroup |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Removes an user from a group.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} a_userUID -- the user UID to be removed
\{[Object]} groupName -- the group to remove from
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if removed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Removes an user from a group. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} a_userUID – the user UID to be removed {Object} groupName – the group to remove from |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | setPassword-Object_String |
---|
| }{:=}{td}h6.setPassword{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
setPassword |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Set a new password for the given userUID.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} a_userUID -- the userUID to set the new password for
\{[String]} password -- the new password
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if changed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Set a new password for the given userUID. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} a_userUID – the userUID to set the new password for {String} password – the new password |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
if(security.checkPassword(security.getUserUID(), 'password1'))
{
security.setPassword(security.getUserUID(), 'password2')
}
else
{
application.output('wrong password')
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=setSecuritySettings-Object}{tr:id=name}{td}h6.setSecuritySettings{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}setSecuritySettings{span}{span}\(dataset){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} dataset -- the dataset with security settings
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | setSecuritySettings-Object |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
setSecuritySettings |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} dataset – the dataset with security settings |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | setUserUID-Object_String |
---|
| }{:=}{td}h6.setUserUID{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
setUserUID |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Set a new userUID for the given userUID.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]} a_userUID -- the userUID to set the new user UID for
\{[String]} newUserUID -- the new user UID
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if changed{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Set a new userUID for the given userUID. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {Object} a_userUID – the userUID to set the new user UID for {String} newUserUID – the new user UID |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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);
}
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table} |