[% IF stand_alone ; PROCESS 'elements.html' ; END; IF employee.first_name or stand_alone %]
[% IF request.pls_import; text('Duplicate User Found: Importing User'); action = 'save_user'; ELSIF user.username; text('Editing User'); action = 'edit_user'; ELSE; text('New User'); action = 'save_user'; END %]

[% IF user.username and not request.pls_import %]
[% text('Username') %] | [% user.username; INCLUDE input element_data = { name = 'username' type = 'hidden' value = user.username }; PROCESS button element_data = { text = text('Delete User') #' name = '__action' type = 'submit' class = 'submit' value = 'delete_user' }; %]
[% ELSE %]
[% text('Username') %] |
[% END %]
[% text('Password') %] | [% INCLUDE input element_data = { type="password" name="reset_password" value="", attributes = { autocomplete = 'off' } } %]
[% IF (request.pls_import == 1) OR !user.username %]
[% text('User creation') %] [% IF request.pls_import; importc1 = 'CHECKED'; importc0 = ''; ELSE; importc1 = ''; importc0 = 'CHECKED'; END; %] | [% PROCESS input element_data = { label = text("Create new user") value = '0' checked = 'CHECKED' name = 'pls_import' type = 'radio' } label_pos = 1 ; %] [% PROCESS input element_data = { label = text("Import existing user") value = '1' checked = '' name = 'pls_import' type = 'radio' } label_pos = 1 ; %] Import an existing user (from another database) This username exists because it is being used with another database; using it with the current database requires it to be imported. Note that technically any existing PostgreSQL "role" that is to be used as a username needs to be imported this way, regardless of whether it is a username in a different database. Creates a new user This username must not be used by any of the other databases. If you want to use a username that is already used with another database, you can do so by selecting the Import option.
[% END # unless employee.entity_id %]

[% IF user.username and not request.pls_import; PROCESS button element_data = { text = text('Reset Password') #' name = '__action' type = 'submit' class = 'submit' value = 'reset_password' }; ELSE; PROCESS button element_data = { text = text('Add User') #' name = '__action' type = 'submit' class = 'submit' value = 'create_user' }; END; PROCESS input element_data = { type = 'hidden' name = 'form_id' value = form_id }; %] [% IF user.entity_id and not request.pls_import%]

[% PROCESS input element_data = { type="hidden" name="user_id" value=user.id }; PROCESS input element_data = { type = 'hidden' name = 'form_id' value = form_id }; %]

[% FOREACH role IN roles %] [% rolcheck = undef; IF user.role_list.grep(role.rolname).size; rolcheck = "checked"; END %] [% PROCESS input element_data = { type = "checkbox" title = role.description label = role.description value = 1 name = "role__" _ role.rolname id = role.rolname checked = rolcheck }, label_pos = 1 %] [% IF loop.even() %]
[% END %] [% END %]

[% PROCESS button element_data = { text = text('Save Groups') #' class = "submit" name = "__action" value = "save_roles" } %]

[% END %]
[% END %]