bus-polkit: add a generic vtable for methods with no params, but with polkit

This commit is contained in:
Lennart Poettering
2025-05-15 09:31:27 +02:00
parent 231cab5c5e
commit 8d7d2edcbb
4 changed files with 11 additions and 12 deletions
+5
View File
@@ -886,3 +886,8 @@ bool varlink_has_polkit_action(sd_varlink *link, const char *action, const char
return false;
#endif
}
const sd_json_dispatch_field dispatch_table_polkit_only[] = {
VARLINK_DISPATCH_POLKIT_FIELD,
{}
};
+4
View File
@@ -35,6 +35,10 @@ static inline int varlink_verify_polkit_async(sd_varlink *link, sd_bus *bus, con
.type = SD_JSON_VARIANT_BOOLEAN, \
}
/* A dispatch table that only accepts (but ignores) the Polkit field, and refuses everything else. This can
* be used wherever methods do not accept any parameters but shall be access controlled via Polkit. */
extern const sd_json_dispatch_field dispatch_table_polkit_only[];
/* Generates the right Varlink introspection field for the allowInteractiveAuthentication field above. To be used in Varlink IDL definitions. */
#define VARLINK_DEFINE_POLKIT_INPUT \
SD_VARLINK_FIELD_COMMENT("Controls whether interactive authentication (via polkit) shall be allowed. If unspecified defaults to false."), \