[Rt-commit] rt branch, admin_ui, updated. e8bd17b538ca173354adea69dfadd62a8b03cf1c
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Jan 15 03:13:39 EST 2010
The branch, admin_ui has been updated
via e8bd17b538ca173354adea69dfadd62a8b03cf1c (commit)
from a0270f3888ef617693a82fb5181fa9fd279b8b49 (commit)
Summary of changes:
lib/RT/Action/CreateUser.pm | 19 +++++++++++++++----
lib/RT/Action/UpdateUser.pm | 16 ++++++++++++----
2 files changed, 27 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit e8bd17b538ca173354adea69dfadd62a8b03cf1c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jan 15 16:13:31 2010 +0800
add privileged field to user create/update actions
diff --git a/lib/RT/Action/CreateUser.pm b/lib/RT/Action/CreateUser.pm
index 2436e8e..441903b 100644
--- a/lib/RT/Action/CreateUser.pm
+++ b/lib/RT/Action/CreateUser.pm
@@ -12,6 +12,8 @@ use Jifty::Param::Schema;
use Jifty::Action schema {
param disabled =>
render as 'Checkbox';
+ param privileged =>
+ render as 'Checkbox';
};
sub arguments {
@@ -34,11 +36,20 @@ sub take_action {
my $self = shift;
$self->SUPER::take_action;
$self->_add_custom_field_values;
- if ( $self->has_argument('disabled') ) {
- my ( $status, $msg ) =
- $self->record->set_disabled( $self->argument_value('disabled') );
- Jifty->log->error( $msg ) unless $status;
+
+ for my $field (qw/disabled privileged/) {
+ next
+ if ( $self->record->$field && $self->argument_value($field) )
+ || ( !$self->record->$field && !$self->argument_value($field) );
+
+ my $set_method = "set_$field";
+ if ( $self->has_argument($field) ) {
+ my ( $status, $msg ) =
+ $self->record->$set_method( $self->argument_value($field) );
+ Jifty->log->error($msg) unless $status;
+ }
}
+
return 1;
}
diff --git a/lib/RT/Action/UpdateUser.pm b/lib/RT/Action/UpdateUser.pm
index 700f31c..6b97b92 100644
--- a/lib/RT/Action/UpdateUser.pm
+++ b/lib/RT/Action/UpdateUser.pm
@@ -12,6 +12,8 @@ use Jifty::Param::Schema;
use Jifty::Action schema {
param disabled =>
render as 'Checkbox';
+ param privileged =>
+ render as 'Checkbox';
};
sub arguments {
@@ -34,10 +36,16 @@ sub take_action {
my $self = shift;
$self->SUPER::take_action;
$self->_add_custom_field_values;
- if ( $self->has_argument('disabled') ) {
- my ( $status, $msg ) =
- $self->record->set_disabled( $self->argument_value('disabled') );
- Jifty->log->error( $msg ) unless $status;
+ for my $field (qw/disabled privileged/) {
+ next
+ if ( $self->record->$field && $self->argument_value($field) )
+ || ( !$self->record->$field && !$self->argument_value($field) );
+ my $set_method = "set_$field";
+ if ( $self->has_argument($field) ) {
+ my ( $status, $msg ) =
+ $self->record->$set_method( $self->argument_value($field) );
+ Jifty->log->error($msg) unless $status;
+ }
}
return 1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list