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

Contents of /lib/Arh/Model/User.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13 - (show annotations)
Fri Nov 30 00:03:15 2007 UTC (16 years, 3 months ago) by dpavlin
File size: 1719 byte(s)
very crude brain dump of various changes:
- introduce command ACL in Arh::DefaultACL which allmost all modes use
- rewrite most templates and implement crude hack Arch::Web::Material
  to render special type of form to add singe material
- version bump [0.02]
1 use strict;
2 use warnings;
3
4 package Arh::Model::User;
5 use Jifty::DBI::Schema;
6
7 use Data::Dump qw/dump/;
8
9 use Arh::Record schema {
10
11 column name =>
12 type is 'text',
13 label is _('First name'),
14 hints is _('How should I display your name to other users?');
15
16 column lastname =>
17 type is 'text',
18 label is _('Last name'),
19 since '0.0.5';
20
21 column email =>
22 type is 'text',
23 is mandatory,
24 label is _('Email address'), default is '', is immutable, is distinct;
25
26 column email_confirmed =>
27 label is _('Email address confirmed?'),
28 type is 'boolean';
29
30 column password =>
31 is unreadable,
32 label is _('Password'),
33 type is 'varchar',
34 hints is _('Your password should be at least six characters'),
35 render_as 'password',
36 # filters are 'Jifty::DBI::Filter::SaltHash',
37 is mandatory;
38
39 column administrator =>
40 type is 'boolean',
41 default is 0,
42 is mandatory,
43 since '0.0.2';
44
45 column organization =>
46 type is 'text',
47 label is _('Organization'),
48 since '0.0.3';
49
50 };
51
52 use Jifty::Plugin::User::Mixin::Model::User;
53 use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
54 #use Jifty::Plugin::OpenID::Mixin::Model::User;
55 use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on
56
57 # Your model-specific methods go here.
58
59 =head2 current_user_can
60
61 =cut
62
63 sub current_user_can {
64 my ( $self, $action,$item,$name ) = @_;
65
66 return 1 if $self->current_user->superuser;
67 return 1 if $self->current_user->administrator;
68
69 warn "current_user_can $action | $item | ", $name ? $name : 'NO NAME', "\n";
70
71 if ( $action eq 'read' && $item eq 'column' ) {
72 foreach ( qw/name lastname email organization/) {
73 return 1 if $name eq $_;
74 }
75 return 0;
76 }
77
78 return 1;
79 }
80
81 1;
82

  ViewVC Help
Powered by ViewVC 1.1.26