#1064 implement tags in database and ACL

This commit is contained in:
Oliver Gorwits
2023-07-18 10:32:02 +01:00
parent b52e58880e
commit f72acb6006
6 changed files with 56 additions and 1 deletions

View File

@@ -201,6 +201,33 @@ sub check_acl {
next RULE;
}
if ($rule =~ m/^tag:(.+)$/) {
my $tag = $1;
my $found = false;
ITEM: foreach my $item (@$things) {
if (blessed $item) {
if ($neg xor ($item->can('tags') and ref [] eq ref $item->tags
and scalar grep {$_ eq $tag} @{ $item->tags })) {
return true if not $all;
$found = true;
last ITEM;
}
}
elsif (ref {} eq ref $item) {
if ($neg xor (exists $item->{'tags'} and ref [] eq ref $item->{'tags'}
and scalar grep {$_ eq $tag} @{ $item->{'tags'} })) {
return true if not $all;
$found = true;
last ITEM;
}
}
}
return false if $all and not $found;
next RULE;
}
# prop:val
# with a check that prop isn't just the first part of a v6 addr
if ($rule =~ m/^([^:]+):(.*)$/ and $1 !~ m/^[a-f0-9]+$/i) {