28.01.2025, 08:24
Hi,
I'm trying to make a script that allows users of the LogicMachine to change their password. The problem is that it deactivates the touch associated with each user and I need each one to see their screen.
Any clues?
Thank you in advance
I'm trying to make a script that allows users of the LogicMachine to change their password. The problem is that it deactivates the touch associated with each user and I need each one to see their screen.
Any clues?
Thank you in advance
Code:
require('apps')
require('json')
require('socket.http')
require('socket.url')
continua = true
i = 1
users = db:getall('SELECT id, login FROM users')
nombre = event.getvalue()
while users[i] ~= nil and continua == true do
name = users[i].login
if name == nombre then
ide = users[i].id
j=i
continua = false
end
i = i+1
end
acl = {
vis ={}, -- Table with the pages to which the user has access
schedulers = {},
trends = {}
}
log (users[j])
log (ide,j,nombre)
log('log',users[j])
pass= 'Passw123'
data = {
id = ide,
name = nombre, -- full name
login = nombre, -- login
password = pass, -- password
password_repeat = pass, -- must match password
active = true,
--access_vis = 'P', -- partial access to visualization
--access_schedulers = '', -- no access to schedulers
-- access_trends = 'P', --F', -- full access to trends
acces_apps ='P',
acces_touch ='F',
allow_objects = "",
homepage = "apps-touch",
acl = json.encode(acl)
}
post = 'data=' .. socket.url.escape(json.encode(data))
res, err = socket.http.request('http://admin:Password1@127.0.0.1/scada-main/users/save', post)
log(res, err, pass)