[Rt-commit] rt branch, 4.4/remove-deprecations-more, created. rt-4.2.12-355-gaad5b54
? sunnavy
sunnavy at bestpractical.com
Thu Oct 29 16:07:34 EDT 2015
The branch, 4.4/remove-deprecations-more has been created
at aad5b543b905972ede984821195796469e6af12f (commit)
- Log -----------------------------------------------------------------
commit 87da7e04bdb564c1f47746250ac0380a699bdc11
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Dec 5 15:04:33 2013 -0500
Replace remaining locations which use ObjectId with id
Fixes: I#31335
diff --git a/lib/RT/Group.pm b/lib/RT/Group.pm
index 5af8327..f83964a 100644
--- a/lib/RT/Group.pm
+++ b/lib/RT/Group.pm
@@ -316,9 +316,7 @@ sub _Create {
my $principal = RT::Principal->new( $self->CurrentUser );
my $principal_id = $principal->Create(
PrincipalType => 'Group',
- ObjectId => '0'
);
- $principal->__Set(Field => 'ObjectId', Value => $principal_id);
$self->SUPER::Create(
id => $principal_id,
@@ -1638,19 +1636,13 @@ sub PreInflate {
my ($id) = $principal->Create(
PrincipalType => 'Group',
Disabled => $disabled,
- ObjectId => 0,
);
# Now we have a principal id, set the id for the group record
$data->{id} = $id;
$importer->Resolve( $principal_uid => ref($principal), $id );
-
- $importer->Postpone(
- for => $uid,
- uid => $principal_uid,
- column => "ObjectId",
- );
+ $data->{id} = $id;
return 1;
}
diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index e65478d..c7941a8 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -180,8 +180,7 @@ sub Create {
# When creating this user, set up a principal Id for it.
my $principal = RT::Principal->new($self->CurrentUser);
my $principal_id = $principal->Create(PrincipalType => 'User',
- Disabled => $args{'Disabled'},
- ObjectId => '0');
+ Disabled => $args{'Disabled'});
# If we couldn't create a principal Id, get the fuck out.
unless ($principal_id) {
$RT::Handle->Rollback();
@@ -190,7 +189,6 @@ sub Create {
return ( 0, $self->loc('Could not create user') );
}
- $principal->__Set(Field => 'ObjectId', Value => $principal_id);
delete $args{'Disabled'};
$self->SUPER::Create(id => $principal_id , %args);
@@ -422,8 +420,7 @@ sub _BootstrapCreate {
# Groups deal with principal ids, rather than user ids.
# When creating this user, set up a principal Id for it.
my $principal = RT::Principal->new($self->CurrentUser);
- my $principal_id = $principal->Create(PrincipalType => 'User', ObjectId => '0');
- $principal->__Set(Field => 'ObjectId', Value => $principal_id);
+ my $principal_id = $principal->Create(PrincipalType => 'User');
# If we couldn't create a principal Id, get the fuck out.
unless ($principal_id) {
@@ -2676,17 +2673,11 @@ sub FindDependencies {
# Memberships in SystemInternal groups
$objs = RT::GroupMembers->new( $self->CurrentUser );
$objs->Limit( FIELD => 'MemberId', VALUE => $self->Id );
- my $principals = $objs->Join(
+ my $groups = $objs->Join(
ALIAS1 => 'main',
FIELD1 => 'GroupId',
- TABLE2 => 'Principals',
- FIELD2 => 'id',
- );
- my $groups = $objs->Join(
- ALIAS1 => $principals,
- FIELD1 => 'ObjectId',
TABLE2 => 'Groups',
- FIELD2 => 'Id',
+ FIELD2 => 'id',
);
$objs->Limit(
ALIAS => $groups,
@@ -2840,19 +2831,13 @@ sub PreInflate {
my ($id) = $principal->Create(
PrincipalType => 'User',
Disabled => $disabled,
- ObjectId => 0,
);
# Now we have a principal id, set the id for the user record
$data->{id} = $id;
$importer->Resolve( $principal_uid => ref($principal), $id );
-
- $importer->Postpone(
- for => $uid,
- uid => $principal_uid,
- column => "ObjectId",
- );
+ $data->{id} = $id;
return $class->SUPER::PreInflate( $importer, $uid, $data );
}
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 8fbd4fc..c9d675c 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -215,7 +215,7 @@ foreach my $table ( qw(Users Groups) ) {
}
elsif ( $a eq 'c' ) {
my $principal_id = create_record( 'Principals',
- id => $id, PrincipalType => $type, ObjectId => $id, Disabled => 0
+ id => $id, PrincipalType => $type, Disabled => 0
);
}
else {
@@ -368,7 +368,7 @@ push @CHECKS, 'User Defined Group Name uniqueness' => sub {
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_condition => join(" and ", map { "$_.id = ${_}p.id and ${_}p.PrincipalType = ? and ${_}p.Disabled != 1" } qw(s t)),
extra_values => ['Group', 'Group'],
action => sub {
return unless prompt(
commit 5fc49cc0d013d5a324a0e740d88bba9090dad686
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Dec 5 13:54:18 2013 -0500
Drop the deprecated "ObjectId" column from Principals
diff --git a/etc/schema.Oracle b/etc/schema.Oracle
index af9c4f8..a718f92 100644
--- a/etc/schema.Oracle
+++ b/etc/schema.Oracle
@@ -66,11 +66,8 @@ CREATE TABLE Principals (
id NUMBER(11,0)
CONSTRAINT Principals_Key PRIMARY KEY,
PrincipalType VARCHAR2(16),
- ObjectId NUMBER(11,0),
Disabled NUMBER(11,0) DEFAULT 0 NOT NULL
);
-CREATE UNIQUE INDEX Principals2 ON Principals (ObjectId);
-
CREATE SEQUENCE GROUPS_seq;
CREATE TABLE Groups (
diff --git a/etc/schema.Pg b/etc/schema.Pg
index 9179cc6..1edf3e4 100644
--- a/etc/schema.Pg
+++ b/etc/schema.Pg
@@ -108,14 +108,11 @@ CREATE SEQUENCE principals_id_seq;
CREATE TABLE Principals (
id INTEGER DEFAULT nextval('principals_id_seq') not null,
PrincipalType VARCHAR(16) not null,
- ObjectId integer,
Disabled integer NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
);
-CREATE INDEX Principals2 ON Principals (ObjectId);
-
diff --git a/etc/schema.SQLite b/etc/schema.SQLite
index 632cfa0..25513cd 100644
--- a/etc/schema.SQLite
+++ b/etc/schema.SQLite
@@ -68,7 +68,6 @@ CREATE INDEX Links4 ON Links(Type,LocalBase);
CREATE TABLE Principals (
id INTEGER PRIMARY KEY,
PrincipalType VARCHAR(16) collate NOCASE not null,
- ObjectId integer,
Disabled int2 NOT NULL DEFAULT 0
) ;
diff --git a/etc/schema.mysql b/etc/schema.mysql
index ca251c2..5ba6653 100644
--- a/etc/schema.mysql
+++ b/etc/schema.mysql
@@ -64,14 +64,10 @@ CREATE INDEX Links4 ON Links (Type,LocalBase);
CREATE TABLE Principals (
id INTEGER AUTO_INCREMENT not null,
PrincipalType VARCHAR(16) not null,
- ObjectId integer, # foreign key to Users or Groups, depending
Disabled int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARACTER SET ascii;
-CREATE INDEX Principals2 ON Principals (ObjectId);
-
-
CREATE TABLE Groups (
id INTEGER NOT NULL AUTO_INCREMENT,
diff --git a/etc/upgrade/4.3.0/schema.Oracle b/etc/upgrade/4.3.0/schema.Oracle
new file mode 100644
index 0000000..d905690
--- /dev/null
+++ b/etc/upgrade/4.3.0/schema.Oracle
@@ -0,0 +1 @@
+ALTER TABLE Principals DROP COLUMN ObjectId;
diff --git a/etc/upgrade/4.3.0/schema.Pg b/etc/upgrade/4.3.0/schema.Pg
new file mode 100644
index 0000000..d905690
--- /dev/null
+++ b/etc/upgrade/4.3.0/schema.Pg
@@ -0,0 +1 @@
+ALTER TABLE Principals DROP COLUMN ObjectId;
diff --git a/etc/upgrade/4.3.0/schema.SQLite b/etc/upgrade/4.3.0/schema.SQLite
new file mode 100644
index 0000000..7ed6f3d
--- /dev/null
+++ b/etc/upgrade/4.3.0/schema.SQLite
@@ -0,0 +1 @@
+-- There is no "drop column" in SQLite
diff --git a/etc/upgrade/4.3.0/schema.mysql b/etc/upgrade/4.3.0/schema.mysql
new file mode 100644
index 0000000..d905690
--- /dev/null
+++ b/etc/upgrade/4.3.0/schema.mysql
@@ -0,0 +1 @@
+ALTER TABLE Principals DROP COLUMN ObjectId;
diff --git a/lib/RT/Principal.pm b/lib/RT/Principal.pm
index d31b948..f4a5ced 100644
--- a/lib/RT/Principal.pm
+++ b/lib/RT/Principal.pm
@@ -772,24 +772,6 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
=cut
-=head2 ObjectId
-
-Returns the current value of ObjectId.
-(In the database, ObjectId is stored as int(11).)
-
-
-
-=head2 SetObjectId VALUE
-
-
-Set ObjectId to VALUE.
-Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
-(In the database, ObjectId will be stored as a int(11).)
-
-
-=cut
-
-
=head2 Disabled
Returns the current value of Disabled.
@@ -816,8 +798,6 @@ sub _CoreAccessible {
{read => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
PrincipalType =>
{read => 1, write => 1, sql_type => 12, length => 16, is_blob => 0, is_numeric => 0, type => 'varchar(16)', default => ''},
- ObjectId =>
- {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
Disabled =>
{read => 1, write => 1, sql_type => 5, length => 6, is_blob => 0, is_numeric => 1, type => 'smallint(6)', default => '0'},
commit aad5b543b905972ede984821195796469e6af12f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Dec 5 15:06:00 2013 -0500
Replace remaining locations which use Type with Name
diff --git a/lib/RT/Group.pm b/lib/RT/Group.pm
index f83964a..50b4f64 100644
--- a/lib/RT/Group.pm
+++ b/lib/RT/Group.pm
@@ -579,12 +579,12 @@ registered role on the specified Domain. Otherwise returns false.
sub ValidateRoleGroup {
my $self = shift;
my %args = (@_);
- return 0 unless $args{Domain} and ($args{Type} or $args{'Name'});
+ return 0 unless $args{Domain} and $args{'Name'};
my $class = $self->RoleClass($args{Domain});
return 0 unless $class;
- return $class->HasRole($args{Type}||$args{'Name'});
+ return $class->HasRole($args{'Name'});
}
=head2 SingleMemberRoleGroup
@@ -622,7 +622,7 @@ sub SetName {
my $value = shift;
my ($status, $msg) = $self->_Set( Field => 'Name', Value => $value );
- return ($status, $msg) unless $status;
+ return ($status, $msg);
}
=head2 Delete
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index c9d675c..0c7e031 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -258,7 +258,7 @@ push @CHECKS, 'User <-> ACL equivalence group' => sub {
);
my $gid = create_record( 'Groups',
- Domain => 'ACLEquivalence', Type => 'UserEquiv', Instance => $id,
+ Domain => 'ACLEquivalence', Name => 'UserEquiv', Instance => $id,
);
},
);
@@ -341,8 +341,8 @@ push @CHECKS, 'Tickets <-> Role Groups' => sub {
};
# additional CHECKS on groups
-push @CHECKS, 'Role Groups (Instance, Type) uniqueness' => sub {
- # Check that Domain, Instance and Type are unique
+push @CHECKS, 'Role Groups (Instance, Name) uniqueness' => sub {
+ # Check that Domain, Instance and Name are unique
return check_uniqueness(
'Groups',
columns => ['Domain', 'Instance', 'Name'],
-----------------------------------------------------------------------
More information about the rt-commit
mailing list