From dc5cdd74af43c70c4d8ff7f5fe722e10e8631091 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Fri, 2 Jan 2009 12:07:41 +0100 Subject: [PATCH] Added the ability to set the staff flag of a user. --- src/IDF/Form/Admin/UserUpdate.php | 10 ++++++++++ src/IDF/templates/idf/gadmin/users/update.html | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/IDF/Form/Admin/UserUpdate.php b/src/IDF/Form/Admin/UserUpdate.php index 458d721..6af03f2 100644 --- a/src/IDF/Form/Admin/UserUpdate.php +++ b/src/IDF/Form/Admin/UserUpdate.php @@ -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) ? array('readonly' => 'readonly') : array(); $this->fields['active'] = new Pluf_Form_Field_Boolean( diff --git a/src/IDF/templates/idf/gadmin/users/update.html b/src/IDF/templates/idf/gadmin/users/update.html index 50af31f..2c431e2 100644 --- a/src/IDF/templates/idf/gadmin/users/update.html +++ b/src/IDF/templates/idf/gadmin/users/update.html @@ -51,7 +51,14 @@ {if $form.f.password2.errors}{$form.f.password2.fieldErrors}{/if} {$form.f.password2|unsafe} - +{if $user.administrator} + +{if $form.f.staff.errors}{$form.f.staff.fieldErrors}{/if} +{$form.f.staff|unsafe} + +{$form.f.staff.labelTag}
+{$form.f.staff.help_text} +{/if} {if $form.f.active.errors}{$form.f.active.fieldErrors}{/if} {$form.f.active|unsafe} @@ -75,6 +82,10 @@

{blocktrans}If you are changing the email address of the user, you need to ensure that you are providing a valid email address{/blocktrans}

+{if $user.administrator} +

{blocktrans}If you give the user staff rights, the user will be +able to create new projects and update other non staff users. +{/blocktrans}

{/if} {/block}