[Rt-commit] r11048 - in rt/branches/3.8-TESTING: html/Search html/User lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Tue Mar 11 22:09:02 EDT 2008
Author: ruz
Date: Tue Mar 11 22:09:02 2008
New Revision: 11048
Added:
rt/branches/3.8-TESTING/html/NoAuth/iCal/
Modified:
rt/branches/3.8-TESTING/html/Search/Results.html
rt/branches/3.8-TESTING/html/User/Prefs.html
rt/branches/3.8-TESTING/lib/RT/User_Overlay.pm
Log:
* integrate iCal extension
Modified: rt/branches/3.8-TESTING/html/Search/Results.html
==============================================================================
--- rt/branches/3.8-TESTING/html/Search/Results.html (original)
+++ rt/branches/3.8-TESTING/html/Search/Results.html Tue Mar 11 22:09:02 2008
@@ -87,6 +87,9 @@
RSSFeedURL => $RSSFeedURL,
ShortQueryString => $ShortQueryString,
&>
+
+<a href="<% $RT::WebURL %>NoAuth/iCal/<% $ical_path %>"><% loc('iCal feed') %></a>
+
% $m->callback( QueryString => $QueryString, CallbackName => 'SearchActions' );
</div>
<%INIT>
@@ -158,6 +161,12 @@
if ($ARGS{'TicketsRefreshInterval'}) {
$session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'};
}
+
+my $ical_path = join '/', map $m->interp->apply_escapes($_, 'u'),
+ $session{'CurrentUser'}->UserObj->Name,
+ substr(Digest::MD5::md5_hex($session{'CurrentUser'}->UserObj->AuthToken . $Query),0,16),
+ $Query;
+
</%INIT>
<%CLEANUP>
$session{'tickets'}->PrepForSerialization();
Modified: rt/branches/3.8-TESTING/html/User/Prefs.html
==============================================================================
--- rt/branches/3.8-TESTING/html/User/Prefs.html (original)
+++ rt/branches/3.8-TESTING/html/User/Prefs.html Tue Mar 11 22:09:02 2008
@@ -166,11 +166,7 @@
</tr>
-<tr>
-
-
-
-<td colspan="2" valign="top" class="boxcontainer">
+<tr><td colspan="2" valign="top" class="boxcontainer">
%if ($UserObj->Privileged) {
<br />
<&| /Widgets/TitleBox, title => loc('Signature') &>
@@ -178,10 +174,18 @@
<%$UserObj->Signature || ''%></textarea>
</&>
% }
+</td></tr>
-</td>
+<tr><td colspan="2" valign="top" class="boxcontainer">
+<&| /Widgets/TitleBox, title => loc('Secret authentication token'), id => "user-prefs-feeds" &>
-</tr>
+<p>All iCal feeds embed a secret token which authorizes you. If the
+URL one of your iCal feeds got exposed to the outside world, you can
+get a new secret, <b>breaking all existing iCal feeds</b> below.</p>
+
+<& /Elements/Submit, Label => loc('Reset secret authentication token'), Name => "ResetAuthToken" &>
+</&>
+</td></tr>
</table>
Modified: rt/branches/3.8-TESTING/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/User_Overlay.pm (original)
+++ rt/branches/3.8-TESTING/lib/RT/User_Overlay.pm Tue Mar 11 22:09:02 2008
@@ -979,6 +979,41 @@
return (undef);
}
+=head3 AuthToken
+
+Returns an authentication string associated with the user.
+
+=cut
+
+sub AuthToken {
+ my $self = shift;
+ my $secret = $self->FirstAttribute("AuthToken");
+ return $secret->Content if $secret;
+
+ my $id = $self->id;
+ $self = RT::User->new( $RT::SystemUser );
+ $self->Load( $id );
+ $secret = substr(Digest::MD5::md5_hex(time . {} . rand()),0,16);
+ my ($status, $msg) = $self->SetAttribute( Name => "AuthToken", Content => $secret );
+ unless ( $status ) {
+ $RT::Logger->error( "Couldn't set auth token: $msg" );
+ return undef;
+ }
+ return $secret;
+}
+
+=head3 GenerateAuthToken
+
+Generate a random authentication string for the user.
+
+=cut
+
+sub GenerateAuthToken {
+ my $self = shift;
+ my $token = substr(Digest::MD5::md5_hex(time . {} . rand()),0,16);
+ return $self->SetAttribute( Name => "AuthToken", Content => $token );
+}
+
=head2 SetDisabled
Toggles the user's disabled flag.
More information about the Rt-commit
mailing list