Jscript API addition for Users

I would like to request an API for creating and managing Users. This request was inspired by the various Time Clock implementations. For people that might want to use Users along with Entities it makes sense to add the ability to add Users along with Entities when running a configuration task for example.

3 Likes

@emre I understand this can be done with simple SQL but as I explained to a community member in a different post its best not to edit database directly so I really feel this API option would be beneficial.

2 Likes

It is already in my to do list but before doing that I hoped people who needs similar api to discuss their needs in advance so I can implement it at once without changing api structure. Considering how it should be structured is hard as it is hard to make changes on api once people starts using it. Creating a user is not a big deal but before I release that api I want to find a solution for custom, dual pin, user pass, membership card, etc. logins as it affects how we create users.

4 Likes

Completely understand. Hopefully others will see this and offer their opinion.

1 Like

It would be great to be able to iterate through users as well as change names and assigna passwords using JScript

Does anyone know if any of this has been implemented?

There is an API for that. I’ll look it up one moment.

api.EntityType(name).Entities().State(name).Update(value);
api.EntityType(name).Fields(name).Exists();
api.EntityType(name).Fields(name).Create(fieldtype,[format],[valuesource],[hidden]);

api.Entity(name).State(name).Update(state);
api.Entity(name).State(name).Get();
api.Entity(name).Data(name).Update(value);
api.Entity(name).Data(name).Get();
api.Entity(name).Exists();
api.Entity(name).Create(entityTypeName);
api.Entity(name).CreateAccount([accountName]);

api.User(name).Create(role);
api.User(name).Exists();

api.UserRole(role).Create();
api.UserRole(role).Exists();

api.AccountType(name).Create([rule|'All','Credit','Debit']);
api.AccountType(name).Exists();

api.Account(name).Exists();
api.Account(name).Create(accountTypeName);

api.PaymentType(name).Processors(name).Exists();
api.PaymentType(name).Processors(name).Create();
api.PaymentType(name).Processors(name).Delete();

api.Rule(name).Exists();

api.AutomationCommand('name').Maps().SetUserRole(role);
api.AutomationCommand('name').Maps().SetTerminal(terminal);
api.AutomationCommand('name').Maps().SetDepartment(department);
api.AutomationCommand('name').Maps().SetTicketType(ticketype);
api.AutomationCommand('name').Maps().SetEnabledStates(states);
api.AutomationCommand('name').Maps().SetVisibleStates(states);
api.AutomationCommand('name').Maps().SetVisibility(visibility);

There may be one available in GQL too I haven’t looked in a while.

Thank you @Jesse but all I see for Users is:

api.User(name).Create(role);
api.User(name).Exists();

I need to iterate, change name and password. Am I missing something?

Try it and see if there is more to it. Maybe there is the ability to do that we just didn’t document it.

Try api.User(name).Password(password); maybe?

Or try api.User(name).Pin(pin);

Why do you need to change name?

I have implemented the Employee entity but each employee needs a User. I am implementing a JScript code to assign a User and Password to a new employee (Activate / Deactivate an employee by assigning and removing a User)

For example, If I hava a new employee John I will look for the next available user E01, E02… and rename it as John. When deactivating the employee I will restore the user John to the next available E01, E02… string

1 Like