Added the ability to set the staff flag of a user.

This commit is contained in:
Loic d'Anterroches 2009-01-02 12:07:41 +01:00
parent dd6b6c9ce6
commit dc5cdd74af
2 changed files with 22 additions and 1 deletions

View File

@ -93,6 +93,16 @@ class IDF_Form_Admin_UserUpdate extends Pluf_Form
), ),
)); ));
if ($extra['request']->user->administrator) {
$this->fields['staff'] = new Pluf_Form_Field_Boolean(
array('required' => false,
'label' => __('Staff'),
'initial' => $this->user->staff,
'widget' => 'Pluf_Form_Widget_CheckboxInput',
'help_text' => __('If you give staff rights to a user, you really need to trust him.'),
));
}
$attrs = ($extra['request']->user->id == $this->user->id) ? $attrs = ($extra['request']->user->id == $this->user->id) ?
array('readonly' => 'readonly') : array(); array('readonly' => 'readonly') : array();
$this->fields['active'] = new Pluf_Form_Field_Boolean( $this->fields['active'] = new Pluf_Form_Field_Boolean(

View File

@ -51,7 +51,14 @@
<td>{if $form.f.password2.errors}{$form.f.password2.fieldErrors}{/if} <td>{if $form.f.password2.errors}{$form.f.password2.fieldErrors}{/if}
{$form.f.password2|unsafe} {$form.f.password2|unsafe}
</td> </td>
</tr> </tr>{if $user.administrator}
<tr>
<th>{if $form.f.staff.errors}{$form.f.staff.fieldErrors}{/if}
{$form.f.staff|unsafe}
</th>
<td>{$form.f.staff.labelTag}<br />
<span class="helptext">{$form.f.staff.help_text}</span></td>
</tr>{/if}
<tr> <tr>
<th>{if $form.f.active.errors}{$form.f.active.fieldErrors}{/if} <th>{if $form.f.active.errors}{$form.f.active.fieldErrors}{/if}
{$form.f.active|unsafe} {$form.f.active|unsafe}
@ -75,6 +82,10 @@
<p>{blocktrans}If you are changing the email address of the user, you <p>{blocktrans}If you are changing the email address of the user, you
need to ensure that you are providing a valid email need to ensure that you are providing a valid email
address{/blocktrans}</p> address{/blocktrans}</p>
{if $user.administrator}
<p>{blocktrans}If you give the user staff rights, the user will be
able to create new projects and update other non staff users.
{/blocktrans}</p> {/if}
</div> </div>
{/block} {/block}