You can access any methods, like Logging, Utils/Tools, Email, Connectors, Business Objects, Plugins, Users, Permissions, Groups and Roles of Simplifier by using the Simplifier object.
Connectors
Simplifier.Connector.<ConnectorName>(payload?: string|object): object Simplifier.Connector.<ConnectorName>.<CallName>(payload?: string|object): object
Examples:
var connectorResult = Simplifier.Connector.MySoap({bindingName: "Binding", "operationName": "MyOp", "soap": {"foo": "bar"}}); var connectorCallResult = Simplifier.Connector.MySoap.myCall({"Foo": "bar"});
Business Objects
Simplifier.BusinessObject.<BOName>.<MethodName>(payload?: string|object, parametrized?: boolean = true): object Simplifier.CurrentBusinessObject.<MethodName>(payload?: string|object, parametrized?: boolean = true): object (--> BOName = Currently executed Business Object)
Examples:
var otherMethodResult = Simplifier.BusinessObject.OtherBO.someMethod({"foo": "bar"}); var unparamtetrizedResult = Simplifier.BusinessObject.OtherBO.someMethod("{\"foo\": \"baz\"}", false); var sameBoResult = Simplifier.CurrentBusinessObject.someMethodOnSameBO({"baz": "baz"}); var noArgsResult = Simplifier.CurrentBusinessObject.methodWithoutArgs();
.
Simplifier.Email.sendTemplateMail(payload: string|object): void
Examples:
Simplifier.Email.sendTemplateMail({ templateNamespace: "MyNamespace", // folder of template templateName: "MyTemplate", // template id emailCharset: "UTF-8", // Charset emailMime: "text/html", // html MIME-Type sender: "sender@test.de", // sender email receiver: "test@test.de", // receiver email receiverCC: ["cc@test.de"], // list of carbon copy email (s) receiverBCC: ["bcc@test.de"], // list of blind carbon copy email(s) replyTo: ["test@test.de"], // list of reply-to email(s) subject: "My Mail", // subject data: {"Var1": "Replacement1"}, // input parameters for template attachments: [ // attachments can directly send via base 64 encoded string { mimeType: "application/pdf", fileName: "test.pdf", b64Data: "base64EncodedPdfFile" }, // or a simplifier business app upload session id { mimeType: "image/jpeg", fileName: "test.jpg", uploadSession: "upload-session-id" } ] });
Utils/Tools
Simplifier.Util.xml2json(xml: string): string Simplifier.Util.json2xml(json: string): string Simplifier.Util.xml2jsonValue(xml: string): object Simplifier.Util.jsonValue2xml(json: string): string Simplifier.Util.encodeBase64(string: string): string Simplifier.Util.decodeBase64(json: string): string
Examples:
var encoded = Simplifier.Util.encodeBase64("String to encode"); var decoded = Simplifier.Util.decodeBase64(encoded);
output.jsonResult = Simplifier.Util.xml2jsonValue("<root><test>hello</test></root>"); output.stringResult = Simplifier.Util.xml2json("<root><test>hello</test></root>");
output.stringInput = Simplifier.Util.json2xml(JSON.stringify({test: "hello"})); output.jsonInput = Simplifier.Util.jsonValue2xml({test: "hello"});
Logging
Simplifier.Log.info | |
Creates a log entry with level INFO.
|
|
Input : (string) | Result: () |
message: string | – |
Simplifier.Log.info(message: string, details: string|object): void
Simplifier.Log.warn | |
Creates a log entry with level WARNING. | |
Input : (string) | Result: () |
message: string | – |
Simplifier.Log.warn(message: string, details: string|object): void
Simplifier.Log.error | |
Creates a log entry with level ERROR. | |
Input : (string) | Result: () |
message: string | – |
Simplifier.Log.error(message: string, details: string|object): void
Simplifier.Log.critical | |
Creates a log entry with level CRITICAL. | |
Input : (string) | Result: () |
message: string | – |
Simplifier.Log.critical(message: string, details: string|object): void
Simplifier.Log.debug | |
Creates a log entry with level DEBUG. | |
Input : (string) | Result: () |
message: string | – |
Simplifier.Log.debug(message: string, details: string|object): void
Examples:
These examples apply to all log levels.
Simplifier.Log.warn("Test log entry"); Simplifier.Log.info("Test log entry with Details", "Details String"); Simplifier.Log.error("Test log entry with Details", {'key': 'value'}); Simplifier.Log.info("test", ["Array",1337,42.1,null,true, {key:"value"},[1,3,3,7]]) Simplifier.Log.critical("test", 1337) Simplifier.Log.debug("test", 42.1) Simplifier.Log.info("test", null) Simplifier.Log.warn("test", true)
Users
Simplifier.User.getAll | |
Retrieves all created users.
|
|
Input : () | Result: Array(object) |
– | [id: Number, login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [{ id: String, name: String, description: String, active: Boolean}]?, groups: [{id: Number, name: String, description: String}]?, attributes: [{name: String, category: String, value: String, description: String?}]?] |
Simplifier.User.getById | |
Retrieves the user with the given id. | |
Input: (number) | Result: object|null |
id: number | id: Number, login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [{ id: String, name: String, description: String, active: Boolean}]?, groups: [{id: Number, name: String, description: String}]?, attributes: [{name: String, category: String, value: String, description: String?}] | null |
Simplifier.User.getByName | |
Retrieves the user with the given login name. | |
Input: (string) | Result: object|null |
loginName: string | id: Number, login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [{ id: String, name: String, description: String, active: Boolean}]?, groups: [{id: Number, name: String, description: String}]?, attributes: [{name: String, category: String, value: String, description: String?}] | null |
Simplifier.User.getCurrentUser | |
Retrieves the currently logged in user. | |
Input: () | Result: object|null |
– | id: Number, login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [{ id: String, name: String, description: String, active: Boolean}]?, groups: [{id: Number, name: String, description: String}]?, attributes: [{name: String, category: String, value: String, description: String?}] | null |
Simplifier.User.create | |
Creates a new user. | |
Input: (object) | Result: object |
login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [String]?, groups: [Number]?, attributes: [{ name: String, category: String, value: String, description: String? }]? |
id: Number, login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [{ id: String, name: String, description: String, active: Boolean}]?, groups: [{id: Number, name: String, description: String}]?, attributes: [{name: String, category: String, value: String, description: String?}] |
Simplifier.User.updateImage | |
Updates a user profile image identified by the assigned id or login name. | |
Input: | Result: () |
loginOrId: String – the user id or login name uploadedImage: String – base64 encoded String for uploading a profile picture |
var user = Simplifier.User.getCurrentUser(); if (user) { if (user.id) { Simplifier.User.updateImage(user.id, { uploadId: input.profileImage, mimeType: input.profileImageMimeType }); } }
Simplifier.User.update | |
Updates a user identified by the assigned login name. | |
Input: (string, object) | Result: object |
login: String | id: Number, login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [{ id: String, name: String, description: String, active: Boolean}]?, groups: [{id: Number, name: String, description: String}]?, attributes: [{name: String, category: String, value: String, description: String?}] |
login: String, firstName: String, lastName: String, email: String, mobileNumber: String?, activeFrom: String?, activeTill: String?, active: Boolean?, salutation: String?, roles: [String]?, groups: [Number]?, attributes: [{ name: String, category: String, value: String, description: String? }]? |
Simplifier.User.delete | |
Deletes a user identified by the assigned id. | |
Input: (number) | Result: () |
id: Number |
– |
Simplifier.User.checkLogin | |
Checks whether a user can login providing the given credentials. | |
Input: (string, string) | Result: (boolean) |
login: string |
true, false |
password: string |
Simplifier.User.assignRole | |
Assigns the role with the given ID to the user, identified by the given login name. | |
Input: (number, string) | Result: () |
loginOrId: string – User login name or user id |
– |
roleId: string |
Simplifier.User.unassignRole | |
Dissolves the user-role relation of the given user and role. | |
Input: (number, string) | Result: () |
loginOrId: string – User login name or user id roleId: string |
– |
Simplifier.User.assignGroup | |
Assigns the group with the given ID to the user, identified by the given login name. | |
Input: (number, number) | Result: () |
loginOrId: string – User login name or user id groupId: number |
– |
Simplifier.User.unassignGroup | |
Dissolves the user-group relation of the given user and group. | |
Input: (string, number) | Result: () |
loginOrId: string – User login name or user id groupId: number |
– |
Simplifier.User.getAttribute | |
Retrieves the attribute with the given name and category of a user identified by the user’s ID. | |
Input: (string, string, string) | Result: (object | null) |
loginOrId: string – User login name or user id name: string – name of the attribute category: string – attribute category |
name: string category: string value: string description: string?| null |
Simplifier.User.getAttributes | |
Retrieves all attributes of the user identified by the given ID. | |
Input: (string) | Result: Array (object) |
loginOrId: string – User login name or user id |
[name: stringcategory: string value: string description: string] |
Simplifier.User.setAttribute | |
Sets (add or update) a user attribute of the user identified by the given name. | |
Input: (number, string, string, object) | Result: () |
loginOrId: string – User login name or user id name: string category: string value: object |
– |
Simplifier.User.deleteAttribute | |
Deletes a user attribute of the user identified by the given name. | |
Input: (number, string, string) | Result: () |
loginOrId: string – User login name or user id name: string category: string |
– |
Simplifier.User.resetPasswordWithEmailTemplate | |
Sends an email with a template for password restoration and resets the password for the provided user identified by the given ID or login name. | |
Input: (number, object) | Result: () |
loginOrId: number – id of the user or login name |
– |
emailData : {
templateNamespace: string, } |
Simplifier.User.setPassword | |
Set a user password for the provided one-time-hash | |
Input: (number, string) | Result: () |
oneTimeHash: string – The URL Query Parameter that generates via resetPasswordWithEmailTemplate to validate the Passwort Reset Link (resetURI) |
– |
newPassword: string – new Passwort |
// generating one time hash var oneTimeHash = JSON.parse(USERS.getOneTimeHash()).json; // set Password var lo_UserRequest = Simplifier.User.setPassword(oneTimeHash, newPassword);
Groups
Simplifier.Group.getAll | |
Returns all groups with all assigned users
|
|
Input : () | Result: Array[object] |
– | [id: Long, groupName: String, description: String, assignedUsers: [{id: Long, loginName: String, firstName: String, lastName: String, email: String}]? |
Simplifier.Group.getById | |
Returns all groups with all assigned users
|
|
Input : (number) | Result: object|null |
id: number |
id: Long, groupName: String, description: String, assignedUsers: [{id: Long, loginName: String, firstName: String, lastName: String, email: String} | null |
Simplifier.Group.create(data: object|string): object Simplifier.Group.update(id: number, data: object|string): object Simplifier.Group.delete(id: number): void Simplifier.Group.getUsersByGroup(id: number): Array<object>
Roles
Simplifier.Role.getAll(): Array<object> Simplifier.Role.getById(id: string): object|null Simplifier.Role.getByName(id: string): object|null Simplifier.Role.create(data: object|string): object Example: Simplifier.Role.create({ name: "MyNewRolename", active: true, permissions: [ { "technicalName": "com.itizzimo.app.MyTestApp", // app has to be existent "characteristic": "execute", "value": ["true"] } ], description: "created via Business Object API", assignedUsers: [] }); Simplifier.Role.update(id: string, data: object|string): object Simplifier.Role.delete(id: string): void Simplifier.Role.getUsersByRole(id: string): Array<object>
Permissions
Simplifier.Permission.checkPermission | |
Checks whether the current logged in user has the granted permission characteristic for the provided permission name.
|
|
Input : (string,string) | |
permissionName: string | true, false |
characteristic: string | |
Output | |
Result: Boolean | true, false |
Simplifier.Permission.checkPermissionCharacteristic | |
Checks whether the current logged in user has the granted permission characteristic value for the provided characteristic for the provided permission name.
|
|
Input : (string,string) | |
permissionName: string | true, false |
characteristic: string | |
characteristicValue: string | |
Output | |
Result: Boolean | true, false |
Example
output.result = Simplifier.Permission.checkPermissionCharacteristic("com.itizzimo.Connector.Academy_REST_Demo", "execute", ["true"]);
Permission Objects
Technical name of permission | characteristics |
com.itizzimo.BusinessObject | admin |
com.itizzimo.Certificates | delete assign view edit download create admin |
com.itizzimo.ChangeLog | read write |
com.itizzimo.ClientBusinessObject | admin |
com.itizzimo.Connector | admin |
com.itizzimo.DataType | admin |
com.itizzimo.DbDesigner | admin |
com.itizzimo.ErrorLog | admin |
com.itizzimo.Group | read create delete edit assign |
com.itizzimo.Job | admin |
com.itizzimo.Library | admin |
com.itizzimo.Marketplace | read sell buy |
com.itizzimo.PermissionTemplate | admin |
com.itizzimo.Plugin | admin |
com.itizzimo.Role | create assign edit read delete |
com.itizzimo.SendEmail | send |
com.itizzimo.ServerSettings | ServerSettings SecuritySettings Auth |
com.itizzimo.SystemLibrary | admin |
com.itizzimo.SystemMessage | create delete update read |
com.itizzimo.Template | admin |
com.itizzimo.TestAllApps | execute |
com.itizzimo.TestAllConnectors | execute |
com.itizzimo.Transport | import create export approve |
com.itizzimo.UiDesigner | create edit delete view admin |
com.itizzimo.Uploader | allowUpload |
com.itizzimo.User | edit read create readSelf editSelf delete |
com.itizzimo.Widget | admin |
com.itizzimo.WidgetGroup | admin |
com.itizzimo.app.APPNAME | view execute delete edit releasemeta |
com.itizzimo.businessobject.BUSINESSOBJECTNAME | view execute delete edit |
com.itizzimo.clientbusinessobject.CLIENTBUSINESSOBJECTNAME | view delete edit |
com.itizzimo.Connector.CONNECTORNAME | view delete edit execute |
com.itizzimo.job.JOBNAME | view delete edit |
com.itizzimo.loginmethod.LOGINMETHODNAME | view delete edit |
com.itizzimo.Plugin.ContentRepo | AccessForeignFile CreateRepository PermissionObjectType MimeMappings PermissionObjectID |
com.itizzimo.Plugin.PdfGeneration | manageTemplates generatePdf |
System
Simplifier.System.getActiveInstance | |
Return the active instance settings.
|
|
Input : () | Result: Object |
{ “name”: the technical name of active instance, } |
Simplifier.System.getActiveInstance(): Object
Simplifier.System.getInstances | |
Return all instance settings.
|
|
Input : () | Result: Array of Objects |
[{ “name”: the technical name of active instance, }] |
Simplifier.System.getInstances(): Array of Objects
Hello,
July 30, 2020 at 16:29how can we get the oneTimeHash for the function Simplifier.User.setPassword?
We have the requirement to implement a user registration where to user can set his password and we want to set the password using a server side business object (after creating the user using the same business object)?
Best regards,
Tobias
HI Tobias,
you have to combine resetPasswordWithEmailTemplate with setPassword . If you don’t want to do it, use JSON.parse(USERS.getOneTimeHash()) for generating the onetime hash.
July 31, 2020 at 08:23Doku is updated