/[SQLSession]/trunk/lib/SQLSession/CurrentUser.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/SQLSession/CurrentUser.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 45 - (hide annotations)
Sun Jan 21 12:19:58 2007 UTC (17 years, 3 months ago) by dpavlin
File size: 680 byte(s)
remove edit mode from configuration and create role method within
currentuser for verification (hard-coded for now)
1 dpavlin 45 use strict;
2     use warnings;
3    
4     package SQLSession::CurrentUser;
5     use base qw/Jifty::CurrentUser/;
6    
7     sub _init {
8     my $self = shift;
9     my %args = (@_);
10    
11     warn "_init";
12    
13     if ( delete $args{'_bootstrap'} ) {
14     $self->is_bootstrap_user(1);
15     } elsif( keys %args ) {
16     $self->user_object( SQLSession::Model::User->new( current_user => $self ) );
17     $self->user_object->load_by_cols( %args );
18     }
19    
20     $self->SUPER::_init(%args);
21     }
22    
23     sub role {
24     my $self = shift;
25     my $role = shift;
26    
27     return 0 unless ($self->current_user->id);
28    
29     warn "role is '$role' for ", $self->current_user->user_object->email, "?";
30    
31     return 1 if ($self->current_user->user_object->email eq 'dpavlin@rot13.org');
32    
33     return 0;
34     }
35    
36    

  ViewVC Help
Powered by ViewVC 1.1.26