Skip to content

Commit

Permalink
[backend] move mergeroles to BSSrcServer::Access
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Sep 8, 2016
1 parent 08783aa commit 86d9f07
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
17 changes: 17 additions & 0 deletions src/backend/BSSrcServer/Access.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,21 @@ sub checksourceaccess {
return 1;
}

# this is kind of a snapshot in time, but good enough for now
sub mergeroles {
my ($projid, $proj) = @_;
my @person;
my @group;
while ($projid ne '') {
$proj ||= BSRevision::readproj_local($projid, 1);
if ($proj) {
push @person, @{$proj->{'person'} || []};
push @group , @{$proj->{'group'} || []};
}
last unless $projid =~ s/:[^:]*$//;
undef $proj;
}
return (\@person, \@group);
}

1;
19 changes: 1 addition & 18 deletions src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -885,23 +885,6 @@ sub getprojquotapackage {
return $packagequota{':packages'};
}

# this is kind of a snapshot in time, but good enough for now
sub mergeroles {
my ($projid, $proj) = @_;
my @person;
my @group;
while ($projid ne '') {
$proj ||= BSRevision::readproj_local($projid, 1);
if ($proj) {
push @person, @{$proj->{'person'} || []};
push @group , @{$proj->{'group'} || []};
}
last unless $projid =~ s/:[^:]*$//;
undef $proj;
}
return (\@person, \@group);
}

sub readbuildenv {
my ($pinfo, $rev, $files, $repoid, $arch) = @_;
my $bifile = "_buildenv.$repoid.$arch";
Expand Down Expand Up @@ -1121,7 +1104,7 @@ sub getprojpack {
}
if ($proj->{'access'}) {
# we need the roles if the project is protected, see checkroles() in the scheduler
my ($person, $group) = mergeroles($projid, $proj);
my ($person, $group) = BSSrcServer::Access::mergeroles($projid, $proj);
$jinfo->{'person'} = $person if $person && @$person;
$jinfo->{'group'} = $group if $group && @$group;
}
Expand Down

0 comments on commit 86d9f07

Please sign in to comment.