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

Diff of /trunk/lib/Transports/Model/User.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 15 by dpavlin, Fri May 26 10:01:16 2006 UTC revision 17 by dpavlin, Fri May 26 14:02:18 2006 UTC
# Line 51  Never display a password Line 51  Never display a password
51    
52  =cut  =cut
53    
54  #sub password {  sub password {
55  #       return undef;          return '*****';
56  #}  }
57    
58    =head2 current_user_can
59    
60    Allows the current user to see all their own attributes and
61    everyone else to see their username.
62    
63    Allows the current user to update any of their own attributes
64    except whether or not their email has been confirmed.
65    
66    Passes everything else off to the superclass.
67    
68    =cut
69    
70    
71    sub current_user_can {
72        my $self  = shift;
73        my $right = shift;
74        my %args  = (@_);
75        #Carp::confess if ($right eq 'read' and not $args{'column'});
76        if ( $right eq 'read'
77            and $self->id == $self->current_user->id )
78        {
79            return 1;
80        } elsif ( $right eq 'read' and $args{'column'} eq 'name' ) {
81            return (1);
82    
83        } elsif ( $right eq 'update'
84            and $self->id == $self->current_user->id
85            and $args{'column'} ne 'email_confirmed' )
86        {
87            return (1);
88        }
89    
90        return $self->SUPER::current_user_can( $right, %args );
91    }
92    
93  1;  1;
94    

Legend:
Removed from v.15  
changed lines
  Added in v.17

  ViewVC Help
Powered by ViewVC 1.1.26