[Rt-commit] rt branch, 4.4/selfservice-show-more-user-info, repushed

Maureen Mirville maureen at bestpractical.com
Tue Jun 26 10:31:06 EDT 2018


The branch 4.4/selfservice-show-more-user-info was deleted and repushed:
       was 303bc6d9e5b3b495470c7980725bf2cd84b9e9d1
       now 1590016867f335b7d2b2692cc0af8c976c0ac2fd

2: 08ab3b671 ! 1: 0c7220668 Clean up SelfService code that is not being used
    @@ -19,8 +19,6 @@
     -
      #A hack to make sure that session gets rewritten.
      $session{'i'}++;
    - 
    -@@
      </%INIT>
      
      <%ARGS>
1: 5b4fbb292 ! 2: edc1fbfa2 Allow self service users varied access to their stored RT user information
    @@ -207,31 +207,6 @@
      
      % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormEnd' );
      
    -@@
    -     }
    - 
    -     my %password_cond = $UserObj->CurrentUserRequireToSetPassword;
    --    if (defined $Pass1 && length $Pass1 ) {
    -+    if (defined $NewPass1 && length $NewPass1 ) {
    -         my ($status, $msg) = $UserObj->SafeSetPassword(
    -             Current      => $CurrentPass,
    --            New          => $Pass1,
    --            Confirmation => $Pass2,
    -+            New          => $NewPass1,
    -+            Confirmation => $NewPass2,
    -         );
    -         push @results, loc("Password: [_1]", $msg);
    -     }
    -@@
    - $Zip  => undef
    - $Country => undef
    - $CurrentPass => undef
    --$Pass1 => undef
    --$Pass2 => undef
    -+$NewPass1 => undef
    -+$NewPass2 => undef
    - $Create=> undef
    - </%ARGS>
     
     diff --git a/share/html/Prefs/Elements/EditAboutMe b/share/html/Prefs/Elements/EditAboutMe
     new file mode 100644
    @@ -353,7 +328,7 @@
     +% if ( $UserObj->__Value('Password') ne '*NO-PASSWORD*' ) {
     +<& /Elements/EditPassword,
     +    User => $UserObj,
    -+    Name => [qw(CurrentPass NewPass1 NewPass2)],
    ++    Name => $PasswordName,
     +&>
     +% }
     +<& /Elements/EditCustomFields, Object => $UserObj, Grouping => 'Access control' &>
    @@ -431,6 +406,7 @@
     +
     +<%ARGS>
     +$UserObj
    ++$PasswordName
     +</%ARGS>
     
     diff --git a/share/html/Prefs/Elements/ShowAboutMe b/share/html/Prefs/Elements/ShowAboutMe
    @@ -587,9 +563,8 @@
      <& /SelfService/Elements/Header, Title => loc('Preferences') &>
      
      <& /Elements/ListActions, actions => \@results &>
    -+% my $pref = RT->Config->Get( 'SelfServiceUserPrefs' ) || '';
     +% if ( $pref eq 'full-edit' ) {
    -+<& /Prefs/Elements/EditAboutMe, UserObj => $user &>
    ++<& /Prefs/Elements/EditAboutMe, UserObj => $user, PasswordName => $password &>
     +% } elsif ( $pref eq 'full-view' ) {
     +<& /Prefs/Elements/ShowAboutMe, UserObj => $user &>
     +% } else {
    @@ -597,6 +572,15 @@
      
      <table width="100%" border="0">
     @@
    + % if ( $user->__Value('Password') ne '*NO-PASSWORD*' ) {
    + <& /Elements/EditPassword,
    +     User => $user,
    +-    Name => [qw(CurrentPass NewPass1 NewPass2)],
    ++    Name => $password,
    + &>
    + % }
    + </&>
    +@@
      <& /Elements/Submit, Label => loc('Save Changes') &>
      </form>
      
    @@ -606,40 +590,71 @@
      my @results;
      
      my $user = $session{'CurrentUser'}->UserObj;
    ++my $password = [ qw(CurrentPass NewPass1 NewPass2) ];
    ++
    ++my $pref = RT->Config->Get( 'SelfServiceUserPrefs' ) || '';
    ++
    ++if ( $pref ne 'full-view' ) {
      
     -if (defined $NewPass1 && length $NewPass1 ) {
    -+if ( defined $NewPass1 && length $NewPass1 ) {
    ++  if ( defined $NewPass1 && length $NewPass1 ) {
          my ($status, $msg) = $user->SafeSetPassword(
    -         Current      => $CurrentPass,
    -         New          => $NewPass1,
    -@@
    - }
    - 
    - my @fields = qw(
    +-        Current      => $CurrentPass,
    +-        New          => $NewPass1,
    +-        Confirmation => $NewPass2,
    ++      Current      => $CurrentPass,
    ++      New          => $NewPass1,
    ++      Confirmation => $NewPass2,
    +     );
    +     push @results, loc("Password: [_1]", $msg);
    +-}
    ++  }
    + 
    +-my @fields = qw(
     -        Lang Timezone
    ++    my @fields = qw(
     +        Name Comments EmailAddress FreeformContactInfo Organization RealName
     +        NickName Lang Gecos HomePhone WorkPhone MobilePhone PagerPhone Address1
     +        Address2 City State Zip Country Timezone
          );
      
    - $m->callback(
    -@@
    +-$m->callback(
    ++  $m->callback(
    +     CallbackName => 'UpdateLogic',
    +     fields       => \@fields,
    +     results      => \@results,
    +     UserObj      => $user,
    +     ARGSRef      => \%ARGS,
    +-);
    ++  );
    + 
    +-push @results, UpdateRecordObject (
    ++  push @results, UpdateRecordObject (
    +     AttributesRef => \@fields,
    +     Object => $user,
          ARGSRef => \%ARGS,
    - );
    - 
    -+push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $user );
    -+
    - if ( $Lang ) {
    +-);
    ++  );
    ++
    ++  push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $user );
    + 
    +-if ( $Lang ) {
    ++  if ( $Lang ) {
          $session{'CurrentUser'}->LanguageHandle($Lang);
          $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
    -@@
    - 
    - #A hack to make sure that session gets rewritten.
    - $session{'i'}++;
    -+
    -+MaybeRedirectForResults(
    +-}
    ++  }
    ++
    ++  #A hack to make sure that session gets rewritten.
    ++  $session{'i'}++;
    + 
    +-#A hack to make sure that session gets rewritten.
    +-$session{'i'}++;
    ++  MaybeRedirectForResults(
     +    Actions   => \@results,
    -+);
    ++  );
    ++
    ++}
      </%INIT>
      
      <%ARGS>
-:  ------- > 3: 40f4d1c55 Remove ModifySelf rights check for Preferences tab in SelfService
3: 303bc6d9e ! 4: 159001686 Add $SelfServiceUserPrefs config tests to verify SelfService display
    @@ -34,15 +34,18 @@
     +
     +    if ( $config eq 'brief' ) {
     +      $m->content_lacks( 'Nickname', "'Brief' option does not contain full user info" );
    ++      $m->content_contains( '<td class="value"><input type="password" name="CurrentPass"', "'Brief' option contains default user info" );
     +    } elsif ( $config eq 'full-view' ) {
     +      $m->content_lacks( '<td class="value"><input name="NickName" value="" /></td>', "'Full-view' option contains no input fields for full user info" );
    ++      $m->content_contains( '<td class="label">Nickname:</td>', "'Full-view' option contains full user info" );
     +    } else {
     +      RT::Test->add_rights( { Principal => $user_a, Right => ['ModifySelf'] } );
     +      my $nickname = 'user_a_nickname';
    -+      $m->form_name('EditAboutMe');
    -+      $m->field( NickName => $nickname );
    -+      $m->submit;
    -+      $m->content_contains( $nickname, "'Full-edit' option allows user to update user info" );
    ++      $m->submit_form_ok({
    ++        form_name  => 'EditAboutMe',
    ++        fields     => { NickName => $nickname,}
    ++      }, 'Form submitted');
    ++      $m->text_contains("NickName changed from (no value) to '$nickname'", "NickName updated");
     +    }
     +  }
     +}



More information about the rt-commit mailing list