Skip to main content
1-Visitor
July 27, 2015
Solved

Create disabled users?

  • July 27, 2015
  • 2 replies
  • 3068 views

I'm trying to programmatically create a few dummy users in Thingworx for a demo. I'm able to easily create them using EntityServices.CreateUser, but there doesn't seem to be a service to disable the created user either on EntityServices or on the User object itself. How can I accomplish that on release 5.4?

Best answer by paic

This will be available in the next release I believe.

2 replies

paic1-VisitorAnswer
1-Visitor
July 28, 2015

This will be available in the next release I believe.

1-Visitor
July 13, 2016

@Pai, do you have are release date for this feature? I am also interested in this feature.

22-Sapphire I
July 13, 2016

This is in the latest 7.x release part of the user Object. EnableUser and DisableUser

12-Amethyst
July 13, 2016

@Pai

I do not have older versions of TWX, but am able to create, disable and enable users using following snippets in Thingworx 7.1

// To create an user

var params = {

    password: <password> /* STRING */,

    name: <name> /* STRING */,

    description: <description> /* STRING */,

    tags: undefined /* TAGS */

};

Resources["EntityServices"].CreateUser(params);

// To disable an enabled user

Users[<username>].DisableUser();

// To enable a disabled user

Users[<username>].EnableUser();

1-Visitor
July 13, 2016

True but it does not create the user as disabled. The user is created as "enabled" than you disable it.

By the way, how can I know if a user is disabled or enabled from within a service.  Is there a property I can check or a service like the one "IsEnabled" available for Things?

12-Amethyst
July 13, 2016

In Release 7.1, I see that it is possible to check as follows:

var enabled = Users[<username>].IsEnabled();