From 0b69e2b99569a1456a8f27c5866ccada580d06c8 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 20 Feb 2023 11:31:11 +0100 Subject: [PATCH] docs: Fix generated names for ACL objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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(' ') for obj in sorted(perms.keys()): klass = classes[obj] - olink = "object_" + obj.lower() + objname = obj.lower().replace("_", "-") + olink = "object_" + objname print('

%s

' % (olink, klass)) print(' ') @@ -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(' ') print(' ' % (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 " {aclfilter}; foreach (@{$aclfilter}) { my @bits = split /:/; - print " \n"; + my $objname = $bits[0]; + $objname =~ s/_/-/g; + my $perm = $bits[1]; + $perm =~ s/_/-/g; + + print " \n"; } print " \n";
%s