[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.6-134-gff87ce6
Thomas Sibley
trs at bestpractical.com
Tue Nov 23 17:09:50 EST 2010
The branch, 3.9-trunk has been updated
via ff87ce6ac66df55473cdacdd1c2376ee668b0bc9 (commit)
via 641d26fce813f1d4b16dfbc730eb893a452e40e4 (commit)
from 159423bae7b8219d54d067855a2acf54a404f42c (commit)
Summary of changes:
sbin/rt-validator.in | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit 641d26fce813f1d4b16dfbc730eb893a452e40e4
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Nov 23 16:20:12 2010 -0500
Fix typo
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 194924d..fa09f57 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -986,7 +986,7 @@ sub check_uniqueness {
my @columns = @{ $args{'columns'} };
print "Checking uniqueness of ( ", join(', ', map "'$_'", @columns )," ) in table '$on'\n"
- if $opt{'versbose'};
+ if $opt{'verbose'};
my ($scond, $tcond);
if ( $scond = $tcond = $args{'condition'} ) {
commit ff87ce6ac66df55473cdacdd1c2376ee668b0bc9
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Nov 23 17:08:39 2010 -0500
Validate group name uniqueness only for enabled groups
The UI will warn the admin if they enable a previously disabled group
with a duplicate name.
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index fa09f57..fda28b7 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -362,10 +362,13 @@ push @CHECKS, 'Role Groups (Instance, Type) uniqueness' => sub {
push @CHECKS, 'User Defined Group Name uniqueness' => sub {
check_uniqueness(
'Groups',
- columns => ['Name'],
- condition => '.Domain = ?',
- bind_values => [ 'UserDefined' ],
- action => sub {
+ columns => ['Name'],
+ condition => '.Domain = ?',
+ bind_values => [ 'UserDefined' ],
+ extra_tables => ['Principals sp', 'Principals tp'],
+ extra_condition => join(" and ", map { "$_.id = ${_}p.ObjectId and ${_}p.PrincipalType = ? and ${_}p.Disabled != 1" } qw(s t)),
+ extra_values => ['Group', 'Group'],
+ action => sub {
return unless prompt(
'Rename', "Found a user defined group with a non-unique Name."
);
@@ -998,13 +1001,16 @@ sub check_uniqueness {
." FROM $on s LEFT JOIN $on t "
." ON s.id != t.id AND ". join(' AND ', map "s.$_ = t.$_", @columns)
. ($tcond? " AND ( $tcond )": "")
+ . ($args{'extra_tables'} ? join(", ", "", @{$args{'extra_tables'}}) : "")
." WHERE t.id IS NOT NULL "
." AND ". join(' AND ', map "s.$_ IS NOT NULL", @columns);
$query .= " AND ( $scond )" if $scond;
+ $query .= " AND ( $args{'extra_condition'} )" if $args{'extra_condition'};
my $sth = execute_query(
$query,
- $args{'bind_values'}? (@{ $args{'bind_values'} }, @{ $args{'bind_values'} }): ()
+ $args{'bind_values'}? (@{ $args{'bind_values'} }, @{ $args{'bind_values'} }): (),
+ $args{'extra_values'}? (@{ $args{'extra_values'} }): ()
);
while ( my ($sid, $tid, @set) = $sth->fetchrow_array ) {
print STDERR "Record #$tid in $on has the same set of values as $sid\n";
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list