docs: Fix generated names for ACL objects

Both the object name and permission name in ACL use '-' instead of '_'
separator when referring to them in the docs or even when used inside of
polkit. Unfortunately the generators used for generating our docs don't
honour this in certain cases which would result in broken names in the
API docs (once they will be generated).

Rename both object and permission name to use dash and reflect that in
the anchor names in the documentation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-02-20 11:31:11 +01:00
parent 91431db94b
commit 0b69e2b995
2 changed files with 14 additions and 5 deletions

View File

@ -88,7 +88,8 @@ print(' <body>')
for obj in sorted(perms.keys()):
klass = classes[obj]
olink = "object_" + obj.lower()
objname = obj.lower().replace("_", "-")
olink = "object_" + objname
print(' <h3><a id="%s">%s</a></h3>' % (olink, klass))
print(' <table>')
@ -112,8 +113,7 @@ for obj in sorted(perms.keys()):
if description is None:
raise Exception("missing description for %s.%s" % (obj, perm))
plink = "perm_" + obj.lower() + "_" + perm.lower()
plink = plink.replace("-", "_")
plink = "perm_" + objname + "_" + perm.lower()
print(' <tr>')
print(' <td><a id="%s">%s</a></td>' % (plink, perm))

View File

@ -2262,7 +2262,11 @@ elsif ($mode eq "client") {
my $acl = $call->{acl};
foreach (@{$acl}) {
my @bits = split /:/;
print " <check object='$bits[0]' perm='$bits[1]'";
my $objname = $bits[0];
$objname =~ s/_/-/g;
my $perm = $bits[1];
$perm =~ s/_/-/g;
print " <check object='$objname' perm='$perm'";
if (defined $bits[2]) {
print " flags='$bits[2]'";
}
@ -2272,7 +2276,12 @@ elsif ($mode eq "client") {
my $aclfilter = $call->{aclfilter};
foreach (@{$aclfilter}) {
my @bits = split /:/;
print " <filter object='$bits[0]' perm='$bits[1]'/>\n";
my $objname = $bits[0];
$objname =~ s/_/-/g;
my $perm = $bits[1];
$perm =~ s/_/-/g;
print " <filter object='$objname' perm='$perm'/>\n";
}
print " </api>\n";