libeos-parental-controls: Support matching against flatpak app IDs

These are the app-specific part of a flatpak ref, and are what’s
available when you have a .desktop file, via the X-Flatpak key in the
.desktop file. For example, for a flatpak ref
‘app/org.gnome.Builder/x86_64/master’, the app ID is
‘org.gnome.Builder’. It makes sense that we’d want to match against app
IDs in some situations, since the user probably doesn’t care about the
architecture or branch of the app they want to proscribe.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://phabricator.endlessm.com/T24016
This commit is contained in:
Philip Withnall 2018-11-14 15:17:18 +00:00
parent 49228974eb
commit 244985f45f
4 changed files with 64 additions and 2 deletions

View file

@ -135,8 +135,10 @@ test_app_filter_builder_non_empty (BuilderFixture *fixture,
g_assert_true (epc_app_filter_is_flatpak_ref_allowed (filter,
"app/org.gnome.Ponies/x86_64/master"));
g_assert_true (epc_app_filter_is_flatpak_app_allowed (filter, "org.gnome.Ponies"));
g_assert_false (epc_app_filter_is_flatpak_ref_allowed (filter,
"app/org.doom.Doom/x86_64/master"));
g_assert_false (epc_app_filter_is_flatpak_app_allowed (filter, "org.doom.Doom"));
g_assert_cmpint (epc_app_filter_get_oars_value (filter, "drugs-alcohol"), ==,
EPC_APP_FILTER_OARS_VALUE_MILD);
@ -168,8 +170,10 @@ test_app_filter_builder_empty (BuilderFixture *fixture,
g_assert_true (epc_app_filter_is_flatpak_ref_allowed (filter,
"app/org.gnome.Ponies/x86_64/master"));
g_assert_true (epc_app_filter_is_flatpak_app_allowed (filter, "org.gnome.Ponies"));
g_assert_true (epc_app_filter_is_flatpak_ref_allowed (filter,
"app/org.doom.Doom/x86_64/master"));
g_assert_true (epc_app_filter_is_flatpak_app_allowed (filter, "org.doom.Doom"));
g_assert_cmpint (epc_app_filter_get_oars_value (filter, "drugs-alcohol"), ==,
EPC_APP_FILTER_OARS_VALUE_UNKNOWN);