Skip to content

Commit d3e76f3

Browse files
committed
treat any kind of permission grant as an auth
1 parent d140910 commit d3e76f3

File tree

1 file changed

+18
-32
lines changed

1 file changed

+18
-32
lines changed

lib/PAUSE/package.pm

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,24 @@ sub perm_check {
129129
my $ins_perms = "INSERT INTO perms (package, userid) VALUES ".
130130
"('$package', '$userid')";
131131

132+
# package has any authorized maintainers? --> case insensitive
133+
my($auth_ids) = $dbh->selectall_arrayref(qq{
134+
SELECT package, userid
135+
FROM primeur
136+
WHERE LOWER(package) = LOWER(?)
137+
UNION
138+
SELECT package, userid
139+
FROM perms
140+
WHERE LOWER(package) = LOWER(?)
141+
UNION
142+
SELECT modid, userid
143+
FROM mods
144+
WHERE LOWER(modid) = LOWER(?)
145+
},
146+
undef,
147+
($package) x 3,
148+
);
149+
132150
if ($self->{FIO}{DIO} && $self->{FIO}{DIO}->isa_regular_perl($dist)) {
133151
local($dbh->{RaiseError}) = 0;
134152
local($dbh->{PrintError}) = 0;
@@ -161,38 +179,6 @@ sub perm_check {
161179
return 1; # P2.1, P3.0
162180
}
163181

164-
# does this package already primary maintainer? -> case insensitive
165-
my($has_primeur) = $dbh->selectrow_hashref(qq{SELECT package
166-
FROM primeur
167-
WHERE LOWER(package) = LOWER(?)},
168-
undef,
169-
$package);
170-
if (! $has_primeur) {
171-
# does this package exist in mods? -> case insensitive
172-
my($has_owner) = $dbh->selectrow_hashref(qq{SELECT modid
173-
FROM mods
174-
WHERE modid = ?},
175-
undef,
176-
$package);
177-
if (! $has_owner) {
178-
# package has neither owner in mods nor maintainer in primeur
179-
local($dbh->{RaiseError}) = 0;
180-
my $ret = $dbh->do($ins_perms);
181-
my $err = "";
182-
$err = $dbh->errstr unless defined $ret;
183-
$ret ||= "";
184-
$self->verbose(1,"Got unowned package: insperms[$ins_perms]ret[$ret]err[$err]\n");
185-
186-
return 1; # P2.2, P3.0
187-
}
188-
}
189-
190-
# package has any authorized maintainers? --> case insensitive
191-
my($auth_ids) = $dbh->selectall_arrayref(qq{SELECT package, userid
192-
FROM perms
193-
WHERE LOWER(package) = LOWER(?)},
194-
undef,
195-
$package);
196182
if (@$auth_ids) {
197183

198184
# we have a package that is already known

0 commit comments

Comments
 (0)