cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Create disabled users?

benr
1-Newbie

Create disabled users?

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?

1 ACCEPTED SOLUTION

Accepted Solutions
paic
1-Newbie
(To:benr)

This will be available in the next release I believe.

View solution in original post

7 REPLIES 7
paic
1-Newbie
(To:benr)

This will be available in the next release I believe.

stanislav
6-Contributor
(To:paic)

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

PaiChung
22-Sapphire I
(To:stanislav)

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

@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();

stanislav
6-Contributor
(To:SajidPatel)

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?

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

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

stanislav
6-Contributor
(To:SajidPatel)

True, I see it now in 7.1

Thanks Sajid

Top Tags