This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Usernames in log
#1
Hi
Is it possible to see usernames in Object Logs?
Of course only in situations which allows this kind of information like direct change of a value from the visualisation in setup where login is required.

Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#2
It's not possible to log it this way because username is not a part of the telegram.
Reply
#3
(07.03.2017, 12:14)Thomas Wrote: Hi
Is it possible to see usernames in Object Logs?
Of course only in situations which allows this kind of information like direct change of a value from the visualisation in setup where login is required.

Thank you

These are some functions which could help you:

- special GAs only for visualisation and log them,
- custom js script which will send some special info about user which clicked some button;
Reply
#4
Dear Admin,
The solution Buuuudzik described is too hardcore. As a new wishlist entry: Would it be possible to create a new "User actions" log? It can log timestamp of the event, IP, username, visu object and it's previous and actual state.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#5
(07.03.2017, 13:26)buuuudzik Wrote:
(07.03.2017, 12:14)Thomas Wrote: Hi
Is it possible to see usernames in Object Logs?
Of course only in situations which allows this kind of information like direct change of a value from the visualisation in setup where login is required.

Thank you

These are some functions which could help you:

- special GAs only for visualisation and log them,
- custom js script which will send some special info about user which clicked some button;

Hi, could you explain the second point..?? how i can check from js the user...???
Reply
#6
You can prepare .lp file with such script:
Code:
<?
now=os.microtime()
last_login = db:getall('SELECT * FROM user_logs ORDER BY created DESC LIMIT 1')
user = last_login[1].login
print(user)
?>  

and you can use it from js.

As in this thread:
http://forum.logicmachine.net/showthread...le#pid3118

Unfortunately there is at least 1 possible problem when 2 users login in the same time(if more than 1 second it should be ok).

Maybe this is not a perfect solution but at this moment can be helpful. You can also improve it.

A minute ago I've found some solution from Erwin and now it is possible to recognize very precisely who is who.

So .lp file should looks like here:
Code:
<?
require('genohm-scada')
require('dbenv')
db = dbenv:new()

ip = ngx.var.remote_addr
user = db:getall("SELECT login FROM user_logs WHERE ip='" .. ip .. "' ORDER BY created DESC LIMIT 1")
print(user[1].login)
?>
Reply
#7
You can use request.username in that lp file.
Reply
#8
(20.04.2017, 15:37)admin Wrote: You can use request.username in that lp file.

Yes this is the most elegant solution and only interesting thing is that when nobody is logged in (only get method in webbrowser) it returns "admin".

With this method .lp file should looks like:
Code:
<?
print(request.username)
?>
Reply


Forum Jump: