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.

Create user by code
#16
(29.08.2022, 06:31)admin Wrote: Password must be at least 8 characters long. active = true is required, otherwise the new user will be inactive. Cloud login (optional) can be specified by setting the login_cloud field. Also add access_mosaic = 'F' to have full access to Mosaic.

Hi Admin, thanks for replying. Indeed, you are absolutely right, the main reason was the length of the password and the fact that I must implement uppercase letters, lowercase letters and numbers, which made me also modify the function that was in charge of changing the password, but it is already solved. On the other hand, on Saturday I had already implemented the active, acces_mosaic etc, but the above was missing. In the end, the function that would take care of changing the user would be like this:

Code:
require('json')
      require('socket.http')
      require('socket.url')

        acl = {
        vis = paginas_visu, -- Table with the pages to which the user has access
        schedulers = {},
        trends = {},
        }


        user = grp.getvalue(user_visu) -- User variable

        data = {
          id = id_user, --  ID user variable
          name = nombre, -- full name
          login = user, -- login
          login_cloud='',
          active= true,
          password = pass, -- Password variable
          password_repeat = pass, -- Must match password variable
          access_vis = 'P', -- full access to visualization
          access_schedulers = '', -- no access to schedulers
          access_trends = 'F', -- full access to trends
          access_apps = '', -- no access to schedulers
          access_mosaic = 'F', -- full access to mosaic
          acl = json.encode(acl)
        }

      post = 'data=' .. socket.url.escape(json.encode(data))
      res, err = socket.http.request('http://admin:admin@127.0.0.1/scada-main/users/save', post)
      log (res, err)
end
Thank you very much
Reply


Messages In This Thread
Create user by code - by gdoro - 03.04.2019, 13:13
RE: Create user by code - by admin - 03.04.2019, 13:35
RE: Create user by code - by gdoro - 03.04.2019, 15:51
RE: Create user by code - by admin - 04.04.2019, 07:21
RE: Create user by code - by Carlos Padilla - 15.05.2019, 16:27
RE: Create user by code - by admin - 16.05.2019, 05:55
RE: Create user by code - by Carlos Padilla - 16.05.2019, 21:35
RE: Create user by code - by Carlos Padilla - 20.05.2019, 16:42
RE: Create user by code - by admin - 21.05.2019, 06:22
RE: Create user by code - by Carlos Padilla - 22.05.2019, 16:32
RE: Create user by code - by admin - 28.05.2019, 12:00
RE: Create user by code - by Carlos Padilla - 30.05.2019, 20:55
RE: Create user by code - by Carlos Padilla - 26.08.2022, 22:39
RE: Create user by code - by admin - 29.08.2022, 06:31
RE: Create user by code - by Carlos Padilla - 29.08.2022, 17:20

Forum Jump: