/[Arh]/lib/Arh/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 /lib/Arh/CurrentUser.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (hide annotations)
Fri Dec 14 14:39:05 2007 UTC (16 years, 4 months ago) by dpavlin
File size: 852 byte(s)
more tweaks on toggle edit to make it (partially) working -- it
works in tests, but reports wrong message (?!)
1 dpavlin 10 use strict;
2     use warnings;
3    
4     package Arh::CurrentUser;
5     use base qw/Jifty::CurrentUser Arh::Model::User/;
6    
7     use Data::Dump qw/dump/;
8    
9     =head2 _init
10    
11     This function will load user data from database
12    
13     =cut
14    
15     sub _init {
16     my $self = shift;
17     my %args = (@_);
18    
19 dpavlin 11 #warn "## _init",dump(@_);
20    
21 dpavlin 10 if ( delete $args{'_bootstrap'} ) {
22     $self->is_bootstrap_user(1);
23 dpavlin 11 }
24    
25 dpavlin 23 my $u = Arh::Model::User->new;
26    
27 dpavlin 11 if ( keys %args ) {
28 dpavlin 10 $u->load_by_cols( %args );
29     if ( $u->id ) {
30     Jifty->log->info("loaded user ",dump( \%args ));
31     } else {
32     Jifty->log->error("Can't load user ",dump( \%args ));
33     }
34     }
35    
36 dpavlin 23 $self->user_object( $u );
37    
38 dpavlin 10 # be superuser
39     #$self->is_superuser(1);
40    
41 dpavlin 11 #warn "## user_object = ",dump( $self->user_object );
42    
43 dpavlin 10 }
44    
45 dpavlin 23 sub editing {
46     my $self = shift;
47     die unless $self->current_user->user_object;
48 dpavlin 34 return $self->current_user->user_object->editing || 0;
49 dpavlin 23 }
50    
51 dpavlin 10 1;

  ViewVC Help
Powered by ViewVC 1.1.26