Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
Table Body (tbody) |
---|
id | addUserToGroup |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
addUserToGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| addUserToGroup |
Span |
---|
| (a_userUID, groupName) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Adds an user to a named group. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} a_userUID – the user UID to be added {Object} groupName – the group to add to |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if added |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var userUID = security.getUserUID();
security.addUserToGroup(userUID, 'groupname');
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
authenticate |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Object |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| authenticate |
Span |
---|
| (authenticator_solution, method, [credentials]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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 {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 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', [globals.userName, 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, [globals.userName, globals.passWord])
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=canDelete|class=node}{tr:id=name}{td}h6.canDelete{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}canDelete{span}{span:id=iets|style=float: left;}\(dataSource){span}{td}{tr}{tr:id=des}{td}Returns a boolean value for security rights.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[String]} dataSource -- the datasource
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if allowed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| canDelete |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a boolean value for security rights. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} dataSource – the datasource |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if allowed |
|
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|class=node}{tr:id=name}{td}h6.canInsert{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}canInsert{span}{span:id=iets|style=float: left;}\(dataSource){span}{td}{tr}{tr:id=des}{td}Returns a boolean value for security rights.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[String]} dataSource -- the datasource
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if allowed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var dataSource = controller.getDataSource();
var canDelete = security.canDelete(dataSource);
var canInsert = security.canInsert(dataSource);
var Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| canInsert |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a boolean value for security rights. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} dataSource – the datasource |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if allowed |
|
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|class=node}{tr:id=name}{td}h6.canRead{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}canRead{span}{span:id=iets|style=float: left;}\(dataSource){span}{td}{tr}{tr:id=des}{td}Returns a boolean value for security rights.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[String]} dataSource -- the datasource
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if allowed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| canRead |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a boolean value for security rights. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} dataSource – the datasource |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if allowed |
|
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|class=node}{tr:id=name}{td}h6.canUpdate{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}canUpdate{span}{span:id=iets|style=float: left;}\(dataSource){span}{td}{tr}{tr:id=des}{td}Returns a boolean value for security rights.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[String]} dataSource -- the datasource
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if allowed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var dataSource = controller.getDataSource(); Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| canUpdate |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a boolean value for security rights. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} dataSource – the datasource |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if allowed |
|
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=changeGroupName|class=node}{tr:id=name}{td}h6.changeGroupName{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}changeGroupName{span}{span:id=iets|style=float: left;}\(oldGroupName, newGroupName){span}{td}{tr}{tr:id=des}{td}Changes the groupname of a group.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} oldGroupName -- the old name
\{[String]} newGroupName -- the new name
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if changed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
security.changeGroupName('oldGroup', 'newGroup');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=changeUserName|class=node}{tr:id=name}{td}h6.changeUserName{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}changeUserName{span}{span:id=iets|style=float: left;}\(a_userUID, username){span}{td}{tr}{tr:id=des}{td}Changes the username of the specified userUID.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} a_userUID -- the userUID to work on
\{[String]} username -- the new username
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if changed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | changeGroupName |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
changeGroupName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| changeGroupName |
Span |
---|
| (oldGroupName, newGroupName) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Changes the groupname of a group. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} oldGroupName – the old name {String} newGroupName – the new name |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if changed |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
security.changeGroupName('oldGroup', 'newGroup');
|
|
|
|
|
Table Body (tbody) |
---|
id | changeUserName |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
changeUserName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| changeUserName |
Span |
---|
| (a_userUID, username) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Changes the username of the specified userUID. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} a_userUID – the userUID to work on {String} username – the new username |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if changed |
|
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=checkPassword|class=node}{tr:id=name}{td}h6.checkPassword{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}checkPassword{span}{span:id=iets|style=float: left;}\(a_userUID, password){span}{td}{tr}{tr:id=des}{td}Returns true if the password for that userUID is correct, else false.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} a_userUID -- the userUID to check the password for
\{[String]} password -- the new password
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if password oke{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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|class=node}{tr:id=name}{td}h6.createGroup{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}createGroup{span}{span:id=iets|style=float: left;}\(groupName){span}{td}{tr}{tr:id=des}{td}Creates a group, returns the groupname (or null when group couldn't be created).{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[String]} groupName -- the group name to create
{td}{tr}{tr:id=ret}{td}*Returns*\\[String] -- the created groupname{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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));
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
checkPassword |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| checkPassword |
Span |
---|
| (a_userUID, password) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns true if the password for that userUID is correct, else false. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} a_userUID – the userUID to check the password for {String} password – the new password |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if password oke |
|
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')
}
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| createGroup |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Creates a group, returns the groupname (or null when group couldn't be created). |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} groupName – the group name to create |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – the created groupname |
|
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);
}
}
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createUser |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Object |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| createUser |
Span |
---|
| (username, password, [userUID]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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 username – the username password – the user password [userUID] – the userUID to use |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns 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=createUser|class=node}{tr:id=name}{td}h6.createUser{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Object]{span}{span:id=iets|style=float: left; font-weight: bold;}createUser{span}{span:id=iets|style=float: left;}\(username, password, \[userUID\]){span}{td}{tr}{tr:id=des}{td}Creates a new user, returns new uid (or null when group couldn't be created or user alreay exist).{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\username -- the username
password -- the user password
\[userUID\] -- the userUID to use
{td}{tr}{tr:id=ret}{td}*Returns*\\[Object] -- the userUID the created userUID, will be same if provided{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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++)
{
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
deleteGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| deleteGroup |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Deletes a group, returns true if no error was reported. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} groupName – the name of the group to delete |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if 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));
// |
|
|
|
| addtoaddUserToGroupremoveUserFromGroup(uid, set.getValue(p,2));
}
|
|
|
|
| // if not remove user, remove user from all the groups
if(!removeUser)getnowallgroupsthatthatusershas(all if above did go wellvar set =getUserGroups 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 Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
deleteUser |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| deleteUser |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Deletes an user. returns true if no error was reported. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} userUID – The UID of the user to be deleted. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns 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++)
{
// |
|
|
|
| deleteuser(the user will be removed from the groups) application.output(set.getValue(p, 2));
// add user to group
security. |
|
|
|
| deleteUseraddUserToGroup(uid, set.getValue(p,2));
}
|
|
|
|
| }
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteGroup|class=node}{tr:id=name}{td}h6.deleteGroup{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}deleteGroup{span}{span:id=iets|style=float: left;}\(groupName){span}{td}{tr}{tr:id=des}{td}Deletes a group, returns true if no error was reported.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} groupName -- the name of the group to delete
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if deleted{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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=deleteUser|class=node}{tr:id=name}{td}h6.deleteUser{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}deleteUser{span}{span:id=iets|style=float: left;}\(userUID){span}{td}{tr}{tr:id=des}{td}Deletes an user. returns true if no error was reported.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} userUID -- The UID of the user to be deleted.
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if the user is successfully deleted.{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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|class=node}{tr:id=name}{td}h6.getClientID{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getClientID{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Returns the client ID.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\[String] -- the clientId as seen on the server admin page{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var clientId = security.getClientID()
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getElementUUIDs|class=node}{tr:id=name}{td}h6.getElementUUIDs{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSDataSet]{span}{span:id=iets|style=float: left; font-weight: bold;}getElementUUIDs{span}{span:id=iets|style=float: left;}\(formname){span}{td}{tr}{tr:id=des}{td}Returns the form elements UUID's as dataset, the one with no name is the form itself.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[String]} formname -- the formname to retieve the dataset for
{td}{tr}{tr:id=ret}{td}*Returns*\\[JSDataSet] -- dataset with element info{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var formElementsUUIDDataSet = security.getElementUUIDs('orders_form');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getGroups|class=node}{tr:id=name}{td}h6.getGroups{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSDataSet]{span}{span:id=iets|style=float: left; font-weight: bold;}getGroups{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Get all the groups (returns a dataset).
first id column is depricated!, use only the group name column.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\[JSDataSet] -- dataset with all the groups{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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 // 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);
}
}
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getClientID |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getClientID |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns the client ID. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – the clientId as seen on the server admin page |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var clientId = security.getClientID()
|
|
|
|
|
Table Body (tbody) |
---|
id | getElementUUIDs |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getElementUUIDs |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSDataSet |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getElementUUIDs |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns the form elements UUID's as dataset, the one with no name is the form itself. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} formname – the formname to retieve the dataset for |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns JSDataSet – dataset with element info |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var formElementsUUIDDataSet = security.getElementUUIDs('orders_form');
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSDataSet |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getGroups |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get all the groups (returns a dataset). first id column is depricated!, use only the group name column. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns JSDataSet – dataset with all the groups |
|
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);
}
}
|
|
|
|
|
Table Body (tbody) |
---|
id | getSystemUserName |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getSystemUserName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getSystemUserName |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Retrieves the username of the currently logged in user on operating system level. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – the os user name |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//gets the current os username
var osUserName = security.getSystemUserName();
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserGroups |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSDataSet |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getUserGroups |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get all the groups of the current user, finds the goups for given user UID if passed as parameter. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} [userUID] – to retrieve the user groups |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns JSDataSet – dataset with groupnames |
|
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
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));
}
}
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getUserName |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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 [userUID] – to retrieve the name |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – the user name |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//gets the current loggedIn username
var userName = security.getUserName();
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getUserUID |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getUserUID |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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 [username] – the username to find the userUID for |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – the userUID |
|
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();
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSDataSet |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getUsers |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get all the users in the security settings (returns a dataset). |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns JSDataSet – dataset with all the users |
|
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
var p = security.getUserGroups(dsUsers.getValue(i,1));
for(k=1;k<=p.getMaxRowIndex();k++)
{
//print to the output |
|
|
|
| name ofdebugger tab: "group" and the group |
|
|
|
|
application.output(set.getValue(p, 2));adduser groupsecurityaddUserToGroup(uid, setoutput("group: " + p.getValue( |
|
|
|
| p // 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|class=node}{tr:id=name}{td}h6.getSystemUserName{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getSystemUserName{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Retrieves the username of the currently logged in user on operating system level.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\[String] -- the os user name{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets the current os username
var osUserName = security.getSystemUserName();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserGroups|class=node}{tr:id=name}{td}h6.getUserGroups{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSDataSet]{span}{span:id=iets|style=float: left; font-weight: bold;}getUserGroups{span}{span:id=iets|style=float: left;}\(\[userUID\]){span}{td}{tr}{tr:id=des}{td}Get all the groups of the current user, finds the goups for given user UID if passed as parameter.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} \[userUID\] -- to retrieve the user groups
{td}{tr}{tr:id=ret}{td}*Returns*\\[JSDataSet] -- dataset with groupnames{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//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
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|class=node}{tr:id=name}{td}h6.getUserName{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getUserName{span}{span:id=iets|style=float: left;}\(\[userUID\]){span}{td}{tr}{tr:id=des}{td}Get the current user name (null if not logged in), finds the user name for given user UID if passed as parameter.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\[userUID\] -- to retrieve the name
{td}{tr}{tr:id=ret}{td}*Returns*\\[String] -- the user name{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets the current loggedIn username
var userName = security.getUserName();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUserUID|class=node}{tr:id=name}{td}h6.getUserUID{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getUserUID{span}{span:id=iets|style=float: left;}\(\[username\]){span}{td}{tr}{tr:id=des}{td}Get the current user UID (null if not logged in), finds the userUID for given user\_name if passed as parameter.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\[username\] -- the username to find the userUID for
{td}{tr}{tr:id=ret}{td}*Returns*\\[String] -- the userUID{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//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|class=node}{tr:id=name}{td}h6.getUsers{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSDataSet]{span}{span:id=iets|style=float: left; font-weight: bold;}getUsers{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Get all the users in the security settings (returns a dataset).{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\[JSDataSet] -- dataset with all the users{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//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
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=login|class=node}{tr:id=name}{td}h6.login{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}login{span}{span:id=iets|style=float: left;}\(display_username, a_userUID, groups){span}{td}{tr}{tr:id=des}{td}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.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[String]} display_username -- the user display name, like 'James Webb'
\{[Object]} a_userUID -- the user UID to process login for
\{[String]\[]} groups -- the groups array
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if loggedin{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var groups = new Array()
groups[0] = 'Administrators'; //normally these groups are for example received from LDAP
var user_uid = globals.email; //also this uid might be received from external authentication method
var ok = security.login(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|class=node}{tr:id=name}{td}h6.logout{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}logout{span}{span:id=iets|style=float: left;}\(\[solutionToLoad\], \[method\], \[argument\]){span}{td}{tr}{tr:id=des}{td}Logout the current user.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\[solutionToLoad\] -- the solution to load after logout
\[method\] -- the method to run in the solution to load
\[argument\] -- the argument to pass to the method to run
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var groups = new Array();
groups[0] = 'testgroup';
var ok = security.login('user1', security.getUserUID('user1') , groups)
if (!ok)
{
plugins.dialogs.showErrorDialog('Login failure', 'Already logged in? or no user_uid/groups specified?', 'OK')
}
else
{
plugins.dialogs.showInfoDialog('Logged in','Logged in','OK')
}
security.logout();
//security.logout('solution_name');//log out and open solution 'solution_name'
//security.logout('solution_name','global_method_name','my_argument');//log out, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'
//note: specifying a solution will not work in developer due to debugger dependencies
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=removeUserFromGroup|class=node}{tr:id=name}{td}h6.removeUserFromGroup{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}removeUserFromGroup{span}{span:id=iets|style=float: left;}\(a_userUID, groupName){span}{td}{tr}{tr:id=des}{td}Removes an user from a group.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} a_userUID -- the user UID to be removed
\{[Object]} groupName -- the group to remove from
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if removed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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=setPassword|class=node}{tr:id=name}{td}h6.setPassword{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}setPassword{span}{span:id=iets|style=float: left;}\(a_userUID, password){span}{td}{tr}{tr:id=des}{td}Set a new password for the given userUID.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} a_userUID -- the userUID to set the new password for
\{[String]} password -- the new password
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if changed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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|class=node}{tr:id=name}{td}h6.setSecuritySettings{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}setSecuritySettings{span}{span:id=iets|style=float: left;}\(dataset){span}{td}{tr}{tr:id=des}{td}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.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} dataset -- the dataset with security settings
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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=setUserUID|class=node}{tr:id=name}{td}h6.setUserUID{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}setUserUID{span}{span:id=iets|style=float: left;}\(a_userUID, newUserUID){span}{td}{tr}{tr:id=des}{td}Set a new userUID for the given userUID.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\\{[Object]} a_userUID -- the userUID to set the new user UID for
\{[String]} newUserUID -- the new user UID
{td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean] -- true if changed{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| login |
Span |
---|
| (display_username, a_userUID, groups) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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 {String} display_username – the user display name, like 'James Webb' {Object} a_userUID – the user UID to process login for {String[]} groups – the groups array |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if loggedin |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var groups = new Array()
groups[0] = 'Administrators'; //normally these groups are for example received from LDAP
var user_uid = globals.email; //also this uid might be received from external authentication method
var ok = security.login(globals.username, user_uid , groups)
if (!ok)
{
plugins.dialogs.showErrorDialog('Login failure', 'Already logged in? or no user_uid/groups specified?', 'OK')
}
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| logout |
Span |
---|
| ([solutionToLoad], [method], [argument]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Logout the current user. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters [solutionToLoad] – the solution to load after logout [method] – the method to run in the solution to load [argument] – the argument to pass to the method to run |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var groups = new Array();
groups[0] = 'testgroup';
var ok = security.login('user1', security.getUserUID('user1') , groups)
if (!ok)
{
plugins.dialogs.showErrorDialog('Login failure', 'Already logged in? or no user_uid/groups specified?', 'OK')
}
else
{
plugins.dialogs.showInfoDialog('Logged in','Logged in','OK')
}
security.logout();
//security.logout('solution_name');//log out and open solution 'solution_name'
//security.logout('solution_name','global_method_name','my_argument');//log out, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'
//note: specifying a solution will not work in developer due to debugger dependencies
|
|
|
|
|
Table Body (tbody) |
---|
id | removeUserFromGroup |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
removeUserFromGroup |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| removeUserFromGroup |
Span |
---|
| (a_userUID, groupName) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Removes an user from a group. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} a_userUID – the user UID to be removed {Object} groupName – the group to remove from |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if removed |
|
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);
}
}
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
setPassword |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| setPassword |
Span |
---|
| (a_userUID, password) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Set a new password for the given userUID. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} a_userUID – the userUID to set the new password for {String} password – the new password |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if changed |
|
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')
}
|
|
|
|
|
Table Body (tbody) |
---|
id | setSecuritySettings |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
setSecuritySettings |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| setSecuritySettings |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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 {Object} dataset – the dataset with security settings |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
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
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
setUserUID |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| setUserUID |
Span |
---|
| (a_userUID, newUserUID) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Set a new userUID for the given userUID. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object} a_userUID – the userUID to set the new user UID for {String} newUserUID – the new user UID |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if changed |
|
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}{table} |