# Add Users and Roles in Event Script

**URL:** <https://forum.inductiveautomation.com/t/add-users-and-roles-in-event-script/10381>\
**Category:** Ignition\
**Created:** [August 22, 2015, 8:46am UTC](https://forum.inductiveautomation.com/t/add-users-and-roles-in-event-script/10381 "2015-08-22T08:46:32Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [August 24, 2015, 8:58am UTC](https://forum.inductiveautomation.com/t/add-users-and-roles-in-event-script/10381/2 "2015-08-24T08:58:47Z")

</div>

Hi Adnan,

You can do this if you set up your User Source with a type of Database, meaning that the user and role details are stored in a SQL database. You can then create a script to write directly to the correct tables: user details go in the auth\_users table, roles in the auth\_roles table and users are mapped to roles in the auth\_user\_rl table.

The easiest thing to do is create a User Source with a type of Database and add a dummy user before looking at the tables to see how those details are stored. Note that the user’s password is stored as an MD5 hash. Creating a user in MySQL would look something like `INSERT INTO auth_users SET username='John', passwd=MD5('password'), fname='John', lname='Smith', schedule='Always', language='en';`

---

_[View the full topic](https://forum.inductiveautomation.com/t/add-users-and-roles-in-event-script/10381)._
