Both the object name and permission name in ACL use '-' instead of '_'
separator when refering to them in the docs or even when used inside of
polkig. 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(a)redhat.com>
---
scripts/genaclperms.py | 6 +++---
src/rpc/gendispatch.pl | 13 +++++++++++--
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/genaclperms.py b/scripts/genaclperms.py
index 43616dad04..eaf4a3d17d 100755
--- a/scripts/genaclperms.py
+++ b/scripts/genaclperms.py
@@ -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))
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 085e2a29d8..c5f5c85811 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -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";
--
2.39.2