[Rt-commit] r5947 - in commitbit: . lib/CommitBit/Action
lib/CommitBit/Notification share/web/templates/admin/project t
jesse at bestpractical.com
jesse at bestpractical.com
Fri Sep 15 23:00:47 EDT 2006
Author: jesse
Date: Fri Sep 15 23:00:47 2006
New Revision: 5947
Modified:
commitbit/ (props changed)
commitbit/lib/CommitBit/Action/CreateProjectMember.pm
commitbit/lib/CommitBit/Model/Project.pm
commitbit/lib/CommitBit/Model/ProjectMember.pm
commitbit/lib/CommitBit/Model/Repository.pm
commitbit/lib/CommitBit/Notification/InviteToProject.pm
commitbit/share/web/templates/admin/project/.people.swp
commitbit/share/web/templates/admin/project/people
commitbit/t/authz.t
Log:
r27550 at pinglin: jesse | 2006-09-16 04:00:38 +0100
* let's try less sql-violating names
Modified: commitbit/lib/CommitBit/Action/CreateProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Action/CreateProjectMember.pm (original)
+++ commitbit/lib/CommitBit/Action/CreateProjectMember.pm Fri Sep 15 23:00:47 2006
@@ -9,9 +9,9 @@
sub arguments {
my $self = shift;
my $args = $self->SUPER::arguments();
- delete $args->{'user'}{valid_values};
- $args->{'user'}{'render_as'} = 'Text';
- $args->{'user'}{'hints'} = _('Please enter an email address. CommitBit will take care of the rest');
+ delete $args->{'person'}{valid_values};
+ $args->{'person'}{'render_as'} = 'Text';
+ $args->{'person'}{'hints'} = _('Please enter an email address. CommitBit will take care of the rest');
return $args;
}
Modified: commitbit/lib/CommitBit/Model/Project.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/Project.pm (original)
+++ commitbit/lib/CommitBit/Model/Project.pm Fri Sep 15 23:00:47 2006
@@ -27,7 +27,7 @@
column 'license' => type is 'text',
valid_values are ('GPLv2' ,'Perl 5.8', 'Artistic 2.0', 'BSD', 'MIT', 'Death and repudiation');
- column 'public' =>
+ column 'publicly_visible' =>
type is 'boolean',
default is '1';
@@ -50,19 +50,19 @@
sub members {
my $self = shift;
my $members = CommitBit::Model::UserCollection->new();
- my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'user');
+ my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'person');
$members->limit(alias =>$projmembers, column => 'project', value => $self->id);
- $members->limit(alias => $projmembers, column => 'role', operator => '=', value => 'author', entry_aggregator => 'or');
- $members->limit(alias => $projmembers, column => 'role', operator => '=', value => 'administrator', entry_aggregator => 'or');
+ $members->limit(alias => $projmembers, column => 'access_level', operator => '=', value => 'author', entry_aggregator => 'or');
+ $members->limit(alias => $projmembers, column => 'access_level', operator => '=', value => 'administrator', entry_aggregator => 'or');
return $members;
}
sub admins {
my $self = shift;
my $members = CommitBit::Model::UserCollection->new();
- my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'user');
+ my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'person');
$members->limit(alias =>$projmembers, column => 'project', value => $self->id);
- $members->limit(alias => $projmembers, column => 'role', operator => '=', value => 'administrator', entry_aggregator => 'or');
+ $members->limit(alias => $projmembers, column => 'access_level', operator => '=', value => 'administrator', entry_aggregator => 'or');
return $members;
}
@@ -82,7 +82,7 @@
my $self = shift;
my $right = shift;
if ($right eq 'read') { return 1 }
- if (($right eq 'create' or $right eq 'update' or $right eq 'delete') and $self->current_user->user_object->admin) {
+ if (($right eq 'create' or $right eq 'update' or $right eq 'delete') and ($self->current_user->user_object && $self->current_user->user_object->admin)) {
return 1;
}
if (( $right eq 'update' or $right eq 'delete') and $self->is_project_admin($self->current_user)) {
Modified: commitbit/lib/CommitBit/Model/ProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/ProjectMember.pm (original)
+++ commitbit/lib/CommitBit/Model/ProjectMember.pm Fri Sep 15 23:00:47 2006
@@ -10,12 +10,12 @@
use CommitBit::Notification::InviteToProject;
use CommitBit::Record schema {
- column user =>
+ column person =>
refers_to CommitBit::Model::User;
column project =>
refers_to CommitBit::Model::Project;
- column role =>
+ column access_level =>
type is 'text',
valid_values are qw(observer author administrator),
default is 'observer';
@@ -28,18 +28,18 @@
my $self = shift;
my %args = (@_);
- $args{'user'} = $self->_email_to_id($args{'user'});
+ $args{'person'} = $self->_email_to_id($args{'person'});
my (@result) = $self->SUPER::create(%args);
if ($self->id) {
- my $invite = CommitBit::Notification::InviteToProject->new( project => $self->project, to => $self->user, sender =>$self->current_user->user_object, role => $self->role)->send;
+ my $invite = CommitBit::Notification::InviteToProject->new( project => $self->project, to => $self->person, sender =>$self->current_user->person_object, access_level => $self->access_level)->send;
}
return (@result);
}
-sub validate_user {
+sub validate_person {
my $self = shift;
my $val = shift;
return (1) if ($val =~ /^\d+$/ || $val =~ /@/);
@@ -47,11 +47,11 @@
}
-sub set_user {
+sub set_person {
my $self = shift;
my $val = shift;
$val = $self->_email_to_id($val);
- $self->_set(column => 'user', value => $val);
+ $self->_set(column => 'person', value => $val);
}
sub _email_to_id {
@@ -70,7 +70,7 @@
if ( $rightname eq 'update' ) { return undef }
if ( $rightname eq 'read' ) { return 1 }
if ( $rightname eq 'delete'
- && $self->user->id == $self->current_user->id )
+ && $self->person->id == $self->current_user->id )
{
return 1;
}
Modified: commitbit/lib/CommitBit/Model/Repository.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/Repository.pm (original)
+++ commitbit/lib/CommitBit/Model/Repository.pm Fri Sep 15 23:00:47 2006
@@ -13,7 +13,7 @@
type is 'text',
is distinct;
is mandatory;
- column path =>
+ column local_path =>
type is 'text';
column description =>
type is 'text',
@@ -96,13 +96,13 @@
warn "That means my prefix is ".$prefix;
- if (exists $args->{path} and length $args->{path}) {
- if ( ! File::Spec->file_name_is_absolute( $args->{'path'} )) {
- $args->{path} = File::Spec->catdir($prefix, $args->{path});
+ if (exists $args->{local_path} and length $args->{local_path}) {
+ if ( ! File::Spec->file_name_is_absolute( $args->{'local_path'} )) {
+ $args->{local_path} = File::Spec->catdir($prefix, $args->{local_path});
}
} else {
- $args->{path} = File::Spec->catdir($prefix, $args->{name});
+ $args->{local_path} = File::Spec->catdir($prefix, $args->{name});
}
my ($id, $msg) = $self->SUPER::create(%$args);
@@ -116,7 +116,7 @@
sub init_repository {
my $self = shift;
- $self->_svnadmin('create', $self->path);
+ $self->_svnadmin('create', $self->local_path);
$self->write_svnserv_config;
$self->write_httpd_config;
}
@@ -126,7 +126,7 @@
my $project = shift;
$self->_svn('mkdir', -m => 'Project '.$project->name.' init by CommitBit '.$CommitBit::VERSION,
- map { "file://".File::Spec::Unix->catdir($self->path, $project->root_path, $_)}
+ map { "file://".File::Spec::Unix->catdir($self->local_path, $project->root_path, $_)}
'', 'trunk', 'branches', 'tags');
$self->write_authz_file();
@@ -183,7 +183,7 @@
foreach my $user ( @{ $project->members->items_array_ref } ) {
print $file $user->email . " = rw\n" || die $@;
}
- if ($project->public) {
+ if ($project->publicly_visible) {
print $file "* = r\n";
}
}
@@ -196,7 +196,7 @@
sub svnconf_file_path {
my $self = shift;
- return File::Spec->catdir($self->path, 'conf', @_);
+ return File::Spec->catdir($self->local_path, 'conf', @_);
}
@@ -270,7 +270,7 @@
my $self = shift;
my $right = shift;
if ($right eq 'read') { return 1 }
- elsif (($right eq 'create' or $right eq 'update' or $right eq 'delete') and $self->current_user->user_object->admin) {
+ elsif (($right eq 'create' or $right eq 'update' or $right eq 'delete') and ($self->current_user->user_object && $self->current_user->user_object->admin)) {
return 1;
}
return 0
Modified: commitbit/lib/CommitBit/Notification/InviteToProject.pm
==============================================================================
--- commitbit/lib/CommitBit/Notification/InviteToProject.pm (original)
+++ commitbit/lib/CommitBit/Notification/InviteToProject.pm Fri Sep 15 23:00:47 2006
@@ -5,7 +5,7 @@
use base qw/CommitBit::Notification/;
-__PACKAGE__->mk_accessors(qw/project sender role/);
+__PACKAGE__->mk_accessors(qw/project sender access_level/);
=head1 NAME
@@ -27,7 +27,7 @@
my $self = shift;
my $project = $self->project;
- my $role = $self->role;
+ my $access_level = $self->access_level;
my $user = $self->to;
my $letme = Jifty::LetMe->new();
@@ -45,7 +45,7 @@
Hi!
-We'd like you to join us as a $role for @{[$project->name]}.
+We'd like you to join us as a $access_level for @{[$project->name]}.
The project uses Subversion to manage its codebase. To check code, in
or out of subversion point your client at:
Modified: commitbit/share/web/templates/admin/project/.people.swp
==============================================================================
Binary files. No diff available.
Modified: commitbit/share/web/templates/admin/project/people
==============================================================================
--- commitbit/share/web/templates/admin/project/people (original)
+++ commitbit/share/web/templates/admin/project/people Fri Sep 15 23:00:47 2006
@@ -7,7 +7,7 @@
<ul>
% while (my $committer = $committers->next) {
% my $member = CommitBit::Model::ProjectMember->new();
-% $member->load_by_cols (project => $project, user => $committer);
+% $member->load_by_cols (project => $project, person => $committer);
% my $del = Jifty->web->new_action(class => 'DeleteProjectMember', record => $member, moniker => 'delete-member-'.$member->id);
<li><%$committer->name_and_email%>
<%$del->form_field('id')%>
@@ -19,8 +19,8 @@
% }
</ul>
<h2><%_('Add a new committer')%></h2>
-<% $new_committer->form_field('user')%>
-<% $new_committer->form_field('role')%>
+<% $new_committer->form_field('person')%>
+<% $new_committer->form_field('access_level')%>
<% $new_committer->form_field('project', render_as => 'Hidden')%>
<% Jifty->web->form->submit(submit => $new_committer, label => 'Invite em!')%>
Modified: commitbit/t/authz.t
==============================================================================
--- commitbit/t/authz.t (original)
+++ commitbit/t/authz.t Fri Sep 15 23:00:47 2006
@@ -30,7 +30,7 @@
arguments => {
user => 'foo at bar.com',
project => $pid,
- role => 'author',
+ access_level => 'author',
}
);
More information about the Rt-commit
mailing list