Logic Machine Forum
Create User with DB - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Create User with DB (/showthread.php?tid=5838)



Create User with DB - Fcs - 14.01.2025

Hi all,

I add a user to the database like this :

Code:
    local user = {
        name = db:escape(name),
        login = db:escape(login),
        password = hashpassword(db:escape(login), "123456"),        
        homepage = "apps-fcs",        
        access_apps = "P",        
        access_vis = '',
        access_mosaic = "F",
        access_schedulers = '',
        access_trends = '',        
        allow_objects = "",        
        active = 1
    }
    
    result, err = db:insert('users', user)
    io.readproc('/etc/init.d/nginx reload')

The user is added, but when I'm try to connect, I get a 403 error !

any idea ?

thanks


RE: Create User with DB - admin - 14.01.2025

Use webrequest library: https://forum.logicmachine.net/showthread.php?tid=4425
You don't need to escape/has any values.


RE: Create User with DB - Fcs - 14.01.2025

Hi admin,

I forgot to mention that I was in a .lp file for an app.

Where did the 403 error come from? j


RE: Create User with DB - admin - 14.01.2025

In current firmware you should be able to use webrequest in .lp files.

You have partial apps access set but no ACL for apps provided.