[Bps-public-commit] r20179 - RT-BugTracker-Public/lib/RT/BugTracker
ruz at bestpractical.com
ruz at bestpractical.com
Wed Dec 2 04:03:21 EST 2009
Author: ruz
Date: Wed Dec 2 04:03:21 2009
New Revision: 20179
Modified:
RT-BugTracker-Public/lib/RT/BugTracker/Public.pm
Log:
* IsPublicUser in the lib
Modified: RT-BugTracker-Public/lib/RT/BugTracker/Public.pm
==============================================================================
--- RT-BugTracker-Public/lib/RT/BugTracker/Public.pm (original)
+++ RT-BugTracker-Public/lib/RT/BugTracker/Public.pm Wed Dec 2 04:03:21 2009
@@ -45,13 +45,15 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
+
+use 5.008003;
+use strict;
+use warnings;
+
package RT::BugTracker::Public;
-use v5.8.3;
our $VERSION = '0.02';
-1;
-
=head1 NAME
RT::BugTracker::Public - Adds a public, (hopefully) userfriendly bug tracking UI to RT
@@ -95,8 +97,24 @@
If you want the public UI to do anything useful. It should NOT have the
ModifySelf right.
+=cut
+
+sub IsPublicUser {
+ my $self = shift;
+
+ my $session = \%HTML::Mason::Commands::session;
+ # XXX: Not sure when it happens
+ return 1 unless $session->{'CurrentUser'} && $session->{'CurrentUser'}->id;
+ return 1 if $session->{'CurrentUser'}->Name eq ($RT::WebPublicUser||'');
+ return 1 if defined $session->{'BitcardUser'};
+ return 1 if defined $session->{'CurrentUser'}->{'OpenID'};
+ return 0;
+}
+
=head1 AUTHOR
Thomas Sibley E<lt>trs at bestpractical.comE<gt>
=cut
+
+1;
More information about the Bps-public-commit
mailing list