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

Maureen Mirville maureen at bestpractical.com
Thu Jul 5 10:52:25 EDT 2018


The branch 4.4/selfservice-show-more-user-info was deleted and repushed:
       was 4dd249c2cfb653d3f11786b26b569dcf9882d05f
       now 6f0adff3a85d4a296dc2be3ba22ad57a6070b28d

-:  ------- > 1: 85b47645d Update article postfix loops from using $_ to a named variable
1: 0c7220668 ! 2: d9b5d635d Remove Signature feature from SelfService Prefs
    @@ -1,6 +1,9 @@
     Author: Maureen E. Mirville <maureen at bestpractical.com>
     
    -    Clean up SelfService code that is not being used
    +    Remove Signature feature from SelfService Prefs
    +    
    +    Self service users do not have rights to set a custom signature.
    +    Remove code mistakenly moved over with other Pref.
     
     diff --git a/share/html/SelfService/Prefs.html b/share/html/SelfService/Prefs.html
     --- a/share/html/SelfService/Prefs.html
2: 6caaadbca ! 3: 8e2e32aa4 Allow self service users varied access to their stored RT user information
    @@ -3,11 +3,12 @@
         Allow self service users varied access to their stored RT user information
         
         The self service user preferences page now has configurable displays
    -    using the config option, $SelfServiceUserPrefs. The default display
    -    remains the same (user can update locale and password). The full
    -    access viewing option allows the user to view all of their stored RT
    -    information (read only). The full access editing option allows users
    -    to make updates to their information.
    +    using the config option, $SelfServiceUserPrefs. The default display,
    +    'edit-prefs', remains the same (user can update locale and password).
    +    The full access viewing option, 'view-info', allows the user to view
    +    all of their stored RT information (read only). The full access
    +    editing option, 'full-edit', allows users to make updates to all of
    +    their RT information.
     
     diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
     --- a/etc/RT_Config.pm.in
    @@ -24,15 +25,15 @@
     +
     +=over
     +
    -+=item C<brief> (the default)
    -+
    -+When set to C<brief>, self service users will be able to update
    ++=item C<edit-prefs> (the default)
    ++
    ++When set to C<edit-prefs>, self service users will be able to update
     +their Timezone and Language preference and update their password.
     +This is the default behavior of RT.
     +
    -+=item C<full-view>
    -+
    -+When set to C<full-view>, users will have full access to all their
    ++=item C<view-info>
    ++
    ++When set to C<view-info>, users will have full access to all their
     +user information stored in RT on a read-only page.
     +
     +=item C<full-edit>
    @@ -44,7 +45,7 @@
     +
     +=cut
     +
    -+Set($SelfServiceUserPrefs, 'brief' );
    ++Set($SelfServiceUserPrefs, 'edit-prefs' );
     +
      =back
      
    @@ -565,7 +566,7 @@
      <& /Elements/ListActions, actions => \@results &>
     +% if ( $pref eq 'full-edit' ) {
     +<& /Prefs/Elements/EditAboutMe, UserObj => $user, PasswordName => $password &>
    -+% } elsif ( $pref eq 'full-view' ) {
    ++% } elsif ( $pref eq 'view-info' ) {
     +<& /Prefs/Elements/ShowAboutMe, UserObj => $user &>
     +% } else {
      <form method="post">
    @@ -594,67 +595,85 @@
     +
     +my $pref = RT->Config->Get( 'SelfServiceUserPrefs' ) || '';
     +
    -+if ( $pref ne 'full-view' ) {
    ++if ( $pref eq 'edit-prefs' || $pref eq 'full-edit' ) {
    ++
    ++    if ( defined $NewPass1 && length $NewPass1 ) {
    ++        my ($status, $msg) = $user->SafeSetPassword(
    ++            Current      => $CurrentPass,
    ++            New          => $NewPass1,
    ++            Confirmation => $NewPass2,
    ++        );
    ++        push @results, loc("Password: [_1]", $msg);
    ++    }
    ++
    ++    my @fields;
    ++
    ++    if ( $pref eq 'edit-prefs' ) {
    ++        @fields = qw( Lang Timezone );
    ++    } else {
    ++        @fields = qw(
    ++            Name Comments EmailAddress FreeformContactInfo Organization RealName
    ++            NickName Lang Gecos HomePhone WorkPhone MobilePhone PagerPhone Address1
    ++            Address2 City State Zip Country Timezone
    ++        );
    ++    }
      
     -if (defined $NewPass1 && length $NewPass1 ) {
    -+  if ( defined $NewPass1 && length $NewPass1 ) {
    -     my ($status, $msg) = $user->SafeSetPassword(
    +-    my ($status, $msg) = $user->SafeSetPassword(
     -        Current      => $CurrentPass,
     -        New          => $NewPass1,
     -        Confirmation => $NewPass2,
    -+      Current      => $CurrentPass,
    -+      New          => $NewPass1,
    -+      Confirmation => $NewPass2,
    ++    $m->callback(
    ++        CallbackName => 'UpdateLogic',
    ++        fields       => \@fields,
    ++        results      => \@results,
    ++        UserObj      => $user,
    ++        ARGSRef      => \%ARGS,
          );
    -     push @results, loc("Password: [_1]", $msg);
    +-    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
    -+  );
    ++    push @results, UpdateRecordObject (
    ++        AttributesRef => \@fields,
    ++        Object => $user,
    ++        ARGSRef => \%ARGS,
    +     );
      
     -$m->callback(
    -+  $m->callback(
    -     CallbackName => 'UpdateLogic',
    -     fields       => \@fields,
    -     results      => \@results,
    -     UserObj      => $user,
    -     ARGSRef      => \%ARGS,
    +-    CallbackName => 'UpdateLogic',
    +-    fields       => \@fields,
    +-    results      => \@results,
    +-    UserObj      => $user,
    +-    ARGSRef      => \%ARGS,
     -);
    -+  );
    - 
    +-
     -push @results, UpdateRecordObject (
    -+  push @results, UpdateRecordObject (
    -     AttributesRef => \@fields,
    -     Object => $user,
    -     ARGSRef => \%ARGS,
    +-    AttributesRef => \@fields,
    +-    Object => $user,
    +-    ARGSRef => \%ARGS,
     -);
    -+  );
    - 
    +-
     -if ( $Lang ) {
    -+  push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $user );
    -+
    -+  if ( $Lang ) {
    -     $session{'CurrentUser'}->LanguageHandle($Lang);
    -     $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
    +-    $session{'CurrentUser'}->LanguageHandle($Lang);
    +-    $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
     -}
    -+  }
    -+
    -+  #A hack to make sure that session gets rewritten.
    -+  $session{'i'}++;
    ++    push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $user );
    ++
    ++    if ( $Lang ) {
    ++        $session{'CurrentUser'}->LanguageHandle($Lang);
    ++        $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
    ++    }
      
     -#A hack to make sure that session gets rewritten.
     -$session{'i'}++;
    -+  MaybeRedirectForResults(
    -+    Actions   => \@results,
    -+  );
    -+
    ++    #A hack to make sure that session gets rewritten.
    ++    $session{'i'}++;
    ++
    ++    MaybeRedirectForResults(
    ++        Actions   => \@results,
    ++    );
     +}
      </%INIT>
      
3: 398002864 ! 4: 974695b76 Update ModifySelf rights check for Preferences tab in SelfService
    @@ -1,10 +1,12 @@
     Author: Maureen E. Mirville <maureen at bestpractical.com>
     
    -    Remove ModifySelf rights check for Preferences tab in SelfService
    +    Update ModifySelf rights check for Preferences tab in SelfService
         
         With the additional display options added with the SelfServiceUserPrefs
    -    config, it is not necessary to check if a user has the right to update
    -    the user's info. See previous commit.
    +    config, a new condition has also been added to this rights check.
    +    Now if a user does not have the ModifySelf right, the Preferences
    +    tab will stil display as long as the SelfServiceUserPrefs config
    +    is set to 'full-view'.
     
     diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
     --- a/share/html/Elements/Tabs
    @@ -27,29 +29,9 @@
      
      my $pref = RT->Config->Get( 'SelfServiceUserPrefs' ) || '';
      
    --if ( $pref ne 'full-view' ) {
    -+if ( $pref eq 'brief' | $pref eq 'full-edit' ) {
    +-if ( $pref eq 'edit-prefs' || $pref eq 'full-edit' ) {
    ++if ( $pref eq 'brief' || $pref eq 'full-edit' ) {
      
    -   if ( defined $NewPass1 && length $NewPass1 ) {
    -     my ($status, $msg) = $user->SafeSetPassword(
    -@@
    -     push @results, loc("Password: [_1]", $msg);
    -   }
    - 
    --  my @fields = qw(
    -+  my @fields;
    -+
    -+  if ( $pref eq 'brief' ) {
    -+    @fields = qw( Lang Timezone );
    -+  } else {
    -+    @fields = qw(
    -       Name Comments EmailAddress FreeformContactInfo Organization RealName
    -       NickName Lang Gecos HomePhone WorkPhone MobilePhone PagerPhone Address1
    -       Address2 City State Zip Country Timezone
    --  );
    -+    );
    -+  }
    - 
    -   $m->callback(
    -     CallbackName => 'UpdateLogic',
    +     if ( defined $NewPass1 && length $NewPass1 ) {
    +         my ($status, $msg) = $user->SafeSetPassword(
     
4: 4dd249c2c ! 5: 42187c99b Add $SelfServiceUserPrefs config tests to verify SelfService display
    @@ -23,21 +23,21 @@
     +  # Verify the $SelfServiceUserPrefs config option renders the correct display at
     +  # /SelfService/Prefs.html for each of the available options
     +
    -+  is( RT->Config->Get( 'SelfServiceUserPrefs' ), 'brief', '$SelfServiceUserPrefs is set to "brief" by default' );
    ++  is( RT->Config->Get( 'SelfServiceUserPrefs' ), 'edit-prefs', '$SelfServiceUserPrefs is set to "edit-prefs" by default' );
     +
    -+  for my $config ( 'brief', 'full-view', 'full-edit' ) {
    ++  for my $config ( 'edit-prefs', 'view-info', 'full-edit' ) {
     +    RT::Test->stop_server;
     +    RT->Config->Set( SelfServiceUserPrefs => $config );
     +    ( $url, $m ) = RT::Test->started_ok;
     +    ok( $m->login('user_a' => 'password'), 'unprivileged user logged in' );
     +    $m->get_ok( '/SelfService/Prefs.html');
     +
    -+    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" );
    ++    if ( $config eq 'edit-prefs' ) {
    ++      $m->content_lacks( 'Nickname', "'Edit-Prefs' option does not contain full user info" );
    ++      $m->content_contains( '<td class="value"><input type="password" name="CurrentPass"', "'Edit-Prefs' option contains default user info" );
    ++    } elsif ( $config eq 'view-info' ) {
    ++      $m->content_lacks( '<td class="value"><input name="NickName" value="" /></td>', "'View-Info' option contains no input fields for full user info" );
    ++      $m->content_contains( '<td class="label">Nickname:</td>', "'View-Info' option contains full user info" );
     +    } else {
     +      RT::Test->add_rights( { Principal => $user_a, Right => ['ModifySelf'] } );
     +      my $nickname = 'user_a_nickname';
    @@ -53,3 +53,4 @@
      # TODO need more SelfService tests
     +
     +done_testing();
    +
-:  ------- > 6: e1bbef928 Add another config option to $SelfServiceUserPrefs
-:  ------- > 7: 6f0adff3a Update $SelfServiceUserPrefs config tests to verify new display option



More information about the rt-commit mailing list