X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FAdmin%2FUsers%2FModify.html;h=814e7f9968850bf6a1df583de3527c1b84a5c3e4;hp=aae38b1738c1dafa309ba0005218d1524ec8e666;hb=e9e0cf0989259b94d9758eceff448666a2e5a5cc;hpb=b4b0c7e72d7eaee2fbfc7022022c9698323203dd diff --git a/rt/share/html/Admin/Users/Modify.html b/rt/share/html/Admin/Users/Modify.html index aae38b173..814e7f996 100755 --- a/rt/share/html/Admin/Users/Modify.html +++ b/rt/share/html/Admin/Users/Modify.html @@ -1,40 +1,40 @@ %# BEGIN BPS TAGGED BLOCK {{{ -%# +%# %# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC -%# -%# +%# +%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +%# +%# %# (Except where explicitly superseded by other copyright notices) -%# -%# +%# +%# %# LICENSE: -%# +%# %# This work is made available to you under the terms of Version 2 of %# the GNU General Public License. A copy of that license should have %# been provided with this software, but in any event can be snarfed %# from www.gnu.org. -%# +%# %# This work is distributed in the hope that it will be useful, but %# WITHOUT ANY WARRANTY; without even the implied warranty of %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %# General Public License for more details. -%# +%# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA %# 02110-1301 or visit their web page on the internet at %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# +%# +%# %# CONTRIBUTION SUBMISSION POLICY: -%# +%# %# (The following paragraph is not intended to limit the rights granted %# to you to modify and distribute this software under the terms of %# the GNU General Public License and is only of importance to you if %# you choose to contribute your changes and enhancements to the %# community by submitting them to Best Practical Solutions, LLC.) -%# +%# %# By intentionally submitting any modifications, corrections or %# derivatives to this work, or any other work intended for use with %# Request Tracker, to Best Practical Solutions, LLC, you confirm that @@ -43,14 +43,10 @@ %# royalty-free, perpetual, license to use, copy, create derivative %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. -%# +%# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/UserTabs, - id => $id, - UserObj => $UserObj, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> @@ -70,41 +66,47 @@ <&|/l&>Username: - <&|/l&>(required) + <&|/l&>(required) <&|/l&>Email: - + <&|/l&>Real Name: - + <&|/l&>Nickname: - + <&|/l&>Unix login: - + <&|/l&>Language: -<& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &> +<& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang||$Lang &> <&|/l&>Extra info: - +
+ +<&| /Widgets/TitleBox, title => loc('Customers') &> +<& /Elements/EditCustomers, Object => $UserObj, CustomerString=> $CustomerString, ServiceString => $ServiceString &> + +
+ <&| /Widgets/TitleBox, title => loc('Access control') &> /> @@ -112,27 +114,12 @@ - /> <&|/l&>Let this user be granted rights
- -% unless (RT->Config->Get('WebExternalAuth') and !RT->Config->Get('WebFallbackToInternalAuth')) { - - - - - - - - -
-<&|/l&>New Password: - - -
-<&|/l&>Retype Password: - - -
-% } + /> <&|/l&>Let this user be granted rights (<&|/l&>Privileged)
+ +<& /Elements/EditPassword, + User => $UserObj, + Name => [qw(CurrentPass Pass1 Pass2)], +&> % $m->callback( %ARGS, CallbackName => 'LeftColumnBottom', UserObj => $UserObj ); @@ -143,39 +130,39 @@ <&|/l&>Organization: - + <&|/l&>Address1: - + <&|/l&>Address2: - + <&|/l&>City: - + <&|/l&>State: - + <&|/l&>Zip: - + <&|/l&>Country: - + @@ -185,22 +172,22 @@ <&|/l&>Residence: -
+
<&|/l&>Work: -
+
<&|/l&>Mobile: -
+
<&|/l&>Pager: -
+
@@ -216,7 +203,7 @@ % if ($UserObj->id) { <& /Elements/EditCustomField, %ARGS, Object => $UserObj, CustomField => $CF &> % } else { -<& /Elements/EditCustomField, %ARGS, NamePrefix => 'Object-RT::User-new-CustomField-', CustomField => $CF &> +<& /Elements/EditCustomField, %ARGS, NamePrefix => 'Object-RT::User--CustomField-', CustomField => $CF &> % } % } @@ -227,12 +214,12 @@ <&| /Widgets/TitleBox, title => loc('Comments about this user') &> - + %if (!$Create && $UserObj->Privileged) {
<&| /Widgets/TitleBox, title => loc('Signature') &> - + % } @@ -249,20 +236,16 @@ <%INIT> -my $current_tab; -my $UserObj = new RT::User($session{'CurrentUser'}); +my $UserObj = RT::User->new($session{'CurrentUser'}); my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results); my ($val, $msg); if ($Create) { - $current_tab = 'Admin/Users/Modify.html?Create=1'; $title = loc("Create a new user"); } else { - $current_tab = 'Admin/Users/Modify.html?id='.$id if $id; - if ( defined $id && $id eq 'new') { ( $val, $msg ) = $UserObj->Create( Name => $Name, @@ -299,12 +282,6 @@ else { if ($val) { push @results, $msg; - foreach my $key ( keys %ARGS) { - # Convert custom fields on the "new" object to custom fields on the one we've just created - if ($key =~ /^Object-RT::User-new-CustomField-(.*)$/) { - $ARGS{'Object-RT::User-'.$val.'-CustomField-'.$1} = delete $ARGS{$key}; - } - } push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj ); } else { push @results, loc('User could not be created: [_1]', $msg); @@ -327,6 +304,7 @@ else { } +$m->callback( %ARGS, CallbackName => 'BeforeUpdate', User => $UserObj, ARGSRef => \%ARGS, Results => \@results ); # If we have a user to modify, lets try. @@ -345,6 +323,8 @@ if ($UserObj->Id && $id ne 'new') { push (@results,@fieldresults); push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj ); + #deal with freeside customer links + push @results, ProcessObjectCustomers( ARGSRef => \%ARGS, Object => $UserObj ); # {{{ Deal with special fields: Privileged, Enabled if ( $SetPrivileged and $Privileged != $UserObj->Privileged ) { @@ -361,25 +341,22 @@ if ($UserObj->Id && $id ne 'new') { } - # }}} } + +my %password_cond = $UserObj->CurrentUserRequireToSetPassword; if ( $UserObj->Id ) { - my $password_not_set; # Deal with Password field - if ( !$Pass1 and !$Pass2 ) { - $password_not_set = 1; - } elsif ( $Pass1 ne $Pass2 ) { - $password_not_set = 1; - push @results, loc("Passwords do not match."); - } elsif ( $Pass1 eq $Pass2 and !$UserObj->IsPassword($Pass1) ) { - my ($code, $msg) = $UserObj->SetPassword($Pass1); - push @results, loc_fuzzy($msg); - $password_not_set = 1 unless $code; + my ($status, $msg) = $UserObj->SafeSetPassword( + Current => $CurrentPass, + New => $Pass1, + Confirmation => $Pass2, + ); + push @results, $msg; + + if ( $id eq 'new' && !$status ) { + push @results, loc("A password was not set, so user won't be able to login."); } - if ($id eq 'new' and $password_not_set) { - push @results, loc("A password was not set, so user won't be able to login."); - } } @@ -388,13 +365,15 @@ unless ( $UserObj->id && $UserObj->Disabled ) { $EnabledChecked = 'checked="checked"'; } -if (!$Create && $UserObj->Privileged()) { +if ((!$Create && $UserObj->Privileged()) or (!$UserObj->Id and $Privileged)) { $PrivilegedChecked = 'checked="checked"'; } -# set the id, so the the menu will have the right info, this needs to -# be done here to avoid creating and then modifying a user -$id = $UserObj->Id; +# This code does automatic redirection if any updates happen. +MaybeRedirectForResults( + Actions => \@results, + Arguments => { id => $UserObj->Id }, +) if $UserObj->Id; @@ -431,7 +410,12 @@ $City => undef $State => undef $Zip => undef $Country => undef +$CurrentPass => undef $Pass1 => undef -$Pass2=> undef +$Pass2 => undef $Create=> undef +$OnlySearchForCustomers => undef +$OnlySearchForServices => undef +$CustomerString => undef +$ServiceString => undef