From: Peter Krempa Date: Mon, 20 Feb 2023 10:31:11 +0000 (+0100) Subject: docs: Fix generated names for ACL objects X-Git-Tag: v9.1.0-rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b69e2b99569a1456a8f27c5866ccada580d06c8;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Ján Tomko --- 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