(minor) allow @all to be combined with other items

This was a very old quirk/oddity.  Doing

    R       =   @all alice

would fail, but you could still do

    R       =   @all
    R       =   alice

Now we fixed it so it's consistent.

----

This also fixed a curious bug that no one ever caught:

    @all = u1 u2        # yes -- there was no check on redefining @all
    repo foo
        R   =   @all u3 # now would not fail because of defining @all

would have given only those 3 users R access to foo, not really @all
users!  This was because the previous failure message was an artifact of
not finding an expansion for @all, not a genuine "why are you saying
@all and then specifying some user explicitly" warning!
This commit is contained in:
Sitaram Chamarty 2010-10-24 18:06:42 +05:30
parent 10289c6d64
commit 8202ad6d8a

View file

@ -126,7 +126,7 @@ sub expand_list
for my $item (@list) for my $item (@list)
{ {
if ($item =~ /^@/) # nested group if ($item =~ /^@/ and $item ne '@all') # nested group
{ {
die "$ABRT undefined group $item\n" unless $groups{$item}; die "$ABRT undefined group $item\n" unless $groups{$item};
# add those names to the list # add those names to the list
@ -183,16 +183,14 @@ sub parse_conf_line
{ {
# grab the list... # grab the list...
@{ $repos_p } = split ' ', $1; @{ $repos_p } = split ' ', $1;
unless (@{ $repos_p } == 1 and $repos_p->[0] eq '@all') { # ...expand groups in the default case
# ...expand groups in the default case @{ $repos_p } = expand_list ( @{ $repos_p } ) unless $GL_BIG_CONFIG;
@{ $repos_p } = expand_list ( @{ $repos_p } ) unless $GL_BIG_CONFIG; # ...sanity check
# ...sanity check for (@{ $repos_p }) {
for (@{ $repos_p }) { die "$ABRT bad reponame $_\n"
die "$ABRT bad reponame $_\n" if ($GL_WILDREPOS and $_ !~ $REPOPATT_PATT);
if ($GL_WILDREPOS and $_ !~ $REPOPATT_PATT); die "$ABRT bad reponame $_ or you forgot to set \$GL_WILDREPOS\n"
die "$ABRT bad reponame $_ or you forgot to set \$GL_WILDREPOS\n" if (not $GL_WILDREPOS and $_ !~ $REPONAME_PATT);
if (not $GL_WILDREPOS and $_ !~ $REPONAME_PATT);
}
} }
s/\bCREAT[EO]R\b/\$creator/g for @{ $repos_p }; s/\bCREAT[EO]R\b/\$creator/g for @{ $repos_p };
} }
@ -215,8 +213,7 @@ sub parse_conf_line
@refs = map { s(/USER/)(/\$gl_user/); $_ } @refs; @refs = map { s(/USER/)(/\$gl_user/); $_ } @refs;
# expand the user list, unless it is just "@all" # expand the user list, unless it is just "@all"
@users = expand_list ( @users ) @users = expand_list ( @users ) unless $GL_BIG_CONFIG;
unless ($GL_BIG_CONFIG or (@users == 1 and $users[0] eq '@all'));
do { die "$ABRT bad username $_\n" unless $_ =~ $USERNAME_PATT } for @users; do { die "$ABRT bad username $_\n" unless $_ =~ $USERNAME_PATT } for @users;
s/\bCREAT[EO]R\b/~\$creator/g for @users; s/\bCREAT[EO]R\b/~\$creator/g for @users;