[Rt-commit] [svn] r1822 - in rt/branches/PLATANO-EXPERIMENTAL-CSS:
. lib/RT
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Thu Nov 11 03:27:17 EST 2004
Author: jesse
Date: Thu Nov 11 03:27:16 2004
New Revision: 1822
Modified:
rt/branches/PLATANO-EXPERIMENTAL-CSS/ (props changed)
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Queue_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm
Log:
r9084 at tinbook: jesse | 2004-11-11T02:59:32.464211Z
r6074 at tinbook: jesse | 2004-10-20T23:26:48.112240Z
RT-Ticket: 5701
RT-Status: resolved
RT-Update: correspond
RT now prevents users from creating objects with 'Name' attributes that are numreric.
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Queue_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Queue_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Queue_Overlay.pm Thu Nov 11 03:27:16 2004
@@ -301,11 +301,27 @@
# {{{ sub Create
+
+
+
=head2 Create
Create takes the name of the new queue
If you pass the ACL check, it creates the queue and returns its queue id.
+=begin testing
+
+my $queue = RT::Queue->new($RT::SystemUser);
+my ($id, $val) = $queue->Create( Name => 'Test1');
+ok($id, $val);
+
+($id, $val) = $queue->Create( Name => '66');
+ok(!$id, $val);
+
+
+=end testing
+
+
=cut
sub Create {
@@ -418,20 +434,14 @@
my $tempqueue = new RT::Queue($RT::SystemUser);
$tempqueue->Load($name);
- #If we couldn't load it :)
- unless ( $tempqueue->id() ) {
- return (1);
- }
-
#If this queue exists, return undef
- #Avoid the ACL check.
if ( $tempqueue->Name() ) {
return (undef);
}
#If the queue doesn't exist, return 1
else {
- return (1);
+ return ($self->SUPER::ValidateName($name));
}
}
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm Thu Nov 11 03:27:16 2004
@@ -549,8 +549,22 @@
}
# }}}
-
+=head2 ValidateName NAME
+
+Validate the name of the record we're creating. Mostly, just make sure it's not a numeric ID, which is invalid for Name
+
+=cut
+
+sub ValidateName {
+ my $self = shift;
+ my $value = shift;
+ if ($value =~ /^\d+$/) {
+ return(0);
+ } else {
+ return (1);
+ }
+}
More information about the Rt-commit
mailing list