<!-- BEGIN [% component.name %] -->
   [% # PROCESS dumper.tt dump = selected_user %]

    [% PROCESS admin/user_nav.tt page = 'user_list' %]

    <h2 align="center">Edit permissions for username: [% selected_user.username %]</h2>

    <p>[% site.html.back_button %]</p>

    <p class="title">Current permissions: [% permissions_type %] settings
        [% IF permissions_type.match('custom') %]
        [ <a href="[% app_url %]/admin/user/reset_user_permissions/[% selected_user.id %]">
            reset to default
        </a> ]
        [% END %]
    </p>

    <form method="post" action="[% app_url %]/admin/user/update_user_permissions/[% selected_user.id %]"
        [% user_details_onsubmit %] name="user_permission" id="user_permission">

    <table>
        <tr>
            <th>Function description</th>
            <th>Active</th>
        </tr>

        [% FOREACH function IN user_permissions; # defaults
			NEXT UNLESS function.detail.match('(default)') %]
			<tr>
				<td>[% function.detail %]</td>
				<td align="center">
					<input type="checkbox" name="function_id" value="[% function.id %]"
						[% 'checked' IF function.selected %] />
				</td>
			</tr>
        [% END %]		
		<tr><td colspan="2" style="background: #f5f5f5"></td></tr>
        [% FOREACH function IN user_permissions; # non-defaults
			NEXT IF function.detail.match('(default)') OR NOT function.active.match('yes') %]
			<tr>
				<td>[% function.detail %]</td>
				<td align="center">
					<input type="checkbox" name="function_id" value="[% function.id %]"
						[% 'checked' IF function.selected %] />
				</td>
			</tr>
        [% END %]
        <tr>
            <td colspan="2" align="center">
                [% site.html.submit %] [% site.html.reset %]
            </td>
        </tr>
	</table>
    </form>
<!-- END [% component.name %] -->
