Script Side Functions list
-
Hi!
I need to make some scripts verifying the last login time of some users....
I was looking in documentation for a list of all functions supported in server side scripting, but I could find it.
I think there is a lot of ways to read, write, change configurations... etc, from this side.Where I can find this? Thanks in advance!!
-
Hi Matias,
To a full list, that's a very large question! I assume you mean scripting data sources, meta points, event handlers, excel reports and such. Scripts can invoke Java code, so they can do most anything! The most authoritative documentation for the possibilities within the Mango codebase would be our Github: https://github.com/infiniteautomation/ma-core-public
Of course, there are some script utilities that are documented in the contextual help, or here: https://help.infiniteautomation.com/about-mango-java-script
So far as the actual task you mention,
I need to make some scripts verifying the last login time of some users
You have a couple options of varying complexity.
- Query for user login events and check that the users in question have logged in at whatever is the appropriate time period. While there is not an events script utility yet, I have answered questions about querying the events from scripts before on the forum. for instance this thread which sends an email of the last day's
DATA_POINT
type event: https://forum.infiniteautomation.com/topic/3147/email-last-day-s-events - Have an event handler on user login events zero out a virtual data point that increments on some interval and has a limit detector that sends an email they've not logged in for X period of time. Since all user login events would be handled by the same event handler it will take some scripting to parse which user has logged in from the
evt.message
or use a no update detector on that point and set it to the login time when they login. - Put a button on a dashboard that they have to hit to zero out their time-since-active incrementing virtual point which has the limit detector, like (2), or the button updates a point with a no update detector.
Script for (2), in an event handler for user login events to get the username:
//English translation only, some other regex or string splitting if other language var username = /User (.*?) logged in/.exec(event.message)[1];
- Query for user login events and check that the users in question have logged in at whatever is the appropriate time period. While there is not an events script utility yet, I have answered questions about querying the events from scripts before on the forum. for instance this thread which sends an email of the last day's