/[transports]/trunk/lib/Transports/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/Transports/CurrentUser.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations)
Fri May 26 23:25:35 2006 UTC (18 years, 1 month ago) by dpavlin
File size: 925 byte(s)
added users list and simple edit form for user, check current_user->admin to
grant permissions
1 dpavlin 5 use warnings;
2     use strict;
3    
4    
5     package Transports::CurrentUser;
6    
7     use base qw(Jifty::CurrentUser);
8    
9     =head2 new PARAMHASH
10    
11     Instantiate a new current user object, loading the user by paramhash:
12    
13     my $item = Transports::Model::Item->new( Transports::CurrentUser->new(email => 'user@site'));
14    
15     if you give the param
16     _bootstrap => 1
17    
18     your object will be marked as a bootstrap user. You can use that to do an endrun around acls.
19    
20     =cut
21    
22    
23    
24     sub _init {
25     my $self = shift;
26     my %args = (@_);
27    
28     if (delete $args{'_bootstrap'} ) {
29     $self->is_bootstrap_user(1);
30     } elsif (keys %args) {
31     $self->user_object(Transports::Model::User->new(current_user => $self));
32     $self->user_object->load_by_cols(%args);
33     }
34     $self->SUPER::_init(%args);
35     }
36    
37 dpavlin 31 =head2 admin
38 dpavlin 5
39 dpavlin 31 Is current user administrator?
40    
41     =cut
42    
43     sub admin {
44     my $self = shift;
45     return unless ($self->user_object);
46     return $self->user_object->admin;
47     }
48    
49 dpavlin 5 1;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26