tree-wide: Replace usages of whitelist/blacklist

Replace usages of the terms whitelist and blacklist with the more
inclusive and more precise terms allowlist and blocklist, which are
actually also more consistent with parts of the codebase, e.g.
mct_app_filter_is_content_type_allowed().

The only API break here is in libmalcontent/app-filter.h but the
relevant API is not used anywhere else in Endless OS beyond this repo,
nor to my knowledge in any other distribution. Also, per the README,
this project's API is not stable, so now is a good time to make this
change.
This commit is contained in:
Matthew Leeds 2020-06-09 15:30:39 -07:00
parent c6fd3c0ad3
commit 15e8a74b21
9 changed files with 135 additions and 135 deletions

View File

@ -61,7 +61,7 @@ set parental controls policies for users.
``` ```
$ # This sets the parental controls policy for user philip to allow no \\ $ # This sets the parental controls policy for user philip to allow no \\
installation of apps with anything more than none for realistic violence, \\ installation of apps with anything more than none for realistic violence, \\
and to blacklist running the org.freedesktop.Bustle flatpak: and to blocklist running the org.freedesktop.Bustle flatpak:
$ malcontent-client set philip \\ $ malcontent-client set philip \\
violence-realistic=none \\ violence-realistic=none \\
app/org.freedesktop.Bustle/x86_64/stable app/org.freedesktop.Bustle/x86_64/stable

View File

@ -24,8 +24,8 @@
The string list contains flatpak application IDs (containing at least one The string list contains flatpak application IDs (containing at least one
dot and no leading slash) and absolute binary paths (containing a leading dot and no leading slash) and absolute binary paths (containing a leading
slash). The boolean value indicates whether this is a whitelist (true) or slash). The boolean value indicates whether this is an allowlist (true)
blacklist (false). or blocklist (false).
--> -->
<property name="AppFilter" type="(bas)" access="readwrite"> <property name="AppFilter" type="(bas)" access="readwrite">
<annotation name="org.freedesktop.Accounts.DefaultValue" <annotation name="org.freedesktop.Accounts.DefaultValue"

View File

@ -64,7 +64,7 @@ struct _MctRestrictApplicationsSelector
GListStore *apps; /* (owned) */ GListStore *apps; /* (owned) */
GAppInfoMonitor *app_info_monitor; /* (owned) */ GAppInfoMonitor *app_info_monitor; /* (owned) */
gulong app_info_monitor_changed_id; gulong app_info_monitor_changed_id;
GHashTable *blacklisted_apps; /* (owned) (element-type GAppInfo) */ GHashTable *blocklisted_apps; /* (owned) (element-type GAppInfo) */
MctAppFilter *app_filter; /* (owned) */ MctAppFilter *app_filter; /* (owned) */
@ -149,7 +149,7 @@ mct_restrict_applications_selector_dispose (GObject *object)
{ {
MctRestrictApplicationsSelector *self = (MctRestrictApplicationsSelector *)object; MctRestrictApplicationsSelector *self = (MctRestrictApplicationsSelector *)object;
g_clear_pointer (&self->blacklisted_apps, g_hash_table_unref); g_clear_pointer (&self->blocklisted_apps, g_hash_table_unref);
g_clear_object (&self->apps); g_clear_object (&self->apps);
if (self->app_info_monitor != NULL && self->app_info_monitor_changed_id != 0) if (self->app_info_monitor != NULL && self->app_info_monitor_changed_id != 0)
@ -237,7 +237,7 @@ mct_restrict_applications_selector_init (MctRestrictApplicationsSelector *self)
self, self,
NULL); NULL);
self->blacklisted_apps = g_hash_table_new_full (g_direct_hash, self->blocklisted_apps = g_hash_table_new_full (g_direct_hash,
g_direct_equal, g_direct_equal,
g_object_unref, g_object_unref,
NULL); NULL);
@ -266,18 +266,18 @@ on_switch_active_changed_cb (GtkSwitch *s,
{ {
gboolean removed; gboolean removed;
g_debug ("Removing %s from blacklisted apps", g_app_info_get_id (app)); g_debug ("Removing %s from blocklisted apps", g_app_info_get_id (app));
removed = g_hash_table_remove (self->blacklisted_apps, app); removed = g_hash_table_remove (self->blocklisted_apps, app);
g_assert (removed); g_assert (removed);
} }
else else
{ {
gboolean added; gboolean added;
g_debug ("Blacklisting %s", g_app_info_get_id (app)); g_debug ("Blocklisting %s", g_app_info_get_id (app));
added = g_hash_table_add (self->blacklisted_apps, g_object_ref (app)); added = g_hash_table_add (self->blocklisted_apps, g_object_ref (app));
g_assert (added); g_assert (added);
} }
@ -345,9 +345,9 @@ create_row_for_app_cb (gpointer item,
g_object_set_data_full (G_OBJECT (w), "GAppInfo", g_object_ref (app), g_object_unref); g_object_set_data_full (G_OBJECT (w), "GAppInfo", g_object_ref (app), g_object_unref);
if (allowed) if (allowed)
g_hash_table_remove (self->blacklisted_apps, app); g_hash_table_remove (self->blocklisted_apps, app);
else else
g_hash_table_add (self->blacklisted_apps, g_object_ref (app)); g_hash_table_add (self->blocklisted_apps, g_object_ref (app));
g_signal_connect (w, "notify::active", G_CALLBACK (on_switch_active_changed_cb), self); g_signal_connect (w, "notify::active", G_CALLBACK (on_switch_active_changed_cb), self);
@ -427,7 +427,7 @@ reload_apps (MctRestrictApplicationsSelector *self)
g_str_has_prefix (g_app_info_get_id (app), "eos-link") || g_str_has_prefix (g_app_info_get_id (app), "eos-link") ||
/* FIXME: Only list flatpak apps and apps with X-Parental-Controls /* FIXME: Only list flatpak apps and apps with X-Parental-Controls
* key set for now; we really need a system-wide MAC to be able to * key set for now; we really need a system-wide MAC to be able to
* reliably support blacklisting system programs. */ * reliably support blocklisting system programs. */
(!g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (app), "X-Flatpak") && (!g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (app), "X-Flatpak") &&
!g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (app), "X-Parental-Controls")) || !g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (app), "X-Parental-Controls")) ||
/* Web browsers are special cased */ /* Web browsers are special cased */
@ -587,7 +587,7 @@ mct_restrict_applications_selector_build_app_filter (MctRestrictApplicationsSele
g_return_if_fail (MCT_IS_RESTRICT_APPLICATIONS_SELECTOR (self)); g_return_if_fail (MCT_IS_RESTRICT_APPLICATIONS_SELECTOR (self));
g_return_if_fail (builder != NULL); g_return_if_fail (builder != NULL);
g_hash_table_iter_init (&iter, self->blacklisted_apps); g_hash_table_iter_init (&iter, self->blocklisted_apps);
while (g_hash_table_iter_next (&iter, (gpointer) &app, NULL)) while (g_hash_table_iter_next (&iter, (gpointer) &app, NULL))
{ {
g_autofree gchar *flatpak_id = NULL; g_autofree gchar *flatpak_id = NULL;
@ -602,12 +602,12 @@ mct_restrict_applications_selector_build_app_filter (MctRestrictApplicationsSele
if (!flatpak_ref) if (!flatpak_ref)
{ {
g_warning ("Skipping blacklisting Flatpak ID %s due to it not being installed", flatpak_id); g_warning ("Skipping blocklisting Flatpak ID %s due to it not being installed", flatpak_id);
continue; continue;
} }
g_debug ("\t\t → Blacklisting Flatpak ref: %s", flatpak_ref); g_debug ("\t\t → Blocklisting Flatpak ref: %s", flatpak_ref);
mct_app_filter_builder_blacklist_flatpak_ref (builder, flatpak_ref); mct_app_filter_builder_blocklist_flatpak_ref (builder, flatpak_ref);
} }
else else
{ {
@ -616,12 +616,12 @@ mct_restrict_applications_selector_build_app_filter (MctRestrictApplicationsSele
if (!path) if (!path)
{ {
g_warning ("Skipping blacklisting executable %s due to it not being found", executable); g_warning ("Skipping blocklisting executable %s due to it not being found", executable);
continue; continue;
} }
g_debug ("\t\t → Blacklisting path: %s", path); g_debug ("\t\t → Blocklisting path: %s", path);
mct_app_filter_builder_blacklist_path (builder, path); mct_app_filter_builder_blocklist_path (builder, path);
} }
} }
} }

View File

@ -107,7 +107,7 @@ struct _MctUserControls
MctAppFilter *filter; /* (owned) (nullable) */ MctAppFilter *filter; /* (owned) (nullable) */
guint selected_age; /* @oars_disabled_age to disable OARS */ guint selected_age; /* @oars_disabled_age to disable OARS */
guint blacklist_apps_source_id; guint blocklist_apps_source_id;
gboolean flushed_on_dispose; gboolean flushed_on_dispose;
ActUserAccountType user_account_type; ActUserAccountType user_account_type;
@ -115,7 +115,7 @@ struct _MctUserControls
gchar *user_display_name; /* (nullable) (owned) */ gchar *user_display_name; /* (nullable) (owned) */
}; };
static gboolean blacklist_apps_cb (gpointer data); static gboolean blocklist_apps_cb (gpointer data);
static void on_restrict_installation_switch_active_changed_cb (GtkSwitch *s, static void on_restrict_installation_switch_active_changed_cb (GtkSwitch *s,
GParamSpec *pspec, GParamSpec *pspec,
@ -254,26 +254,26 @@ get_user_display_name (ActUser *user)
} }
static void static void
schedule_update_blacklisted_apps (MctUserControls *self) schedule_update_blocklisted_apps (MctUserControls *self)
{ {
if (self->blacklist_apps_source_id > 0) if (self->blocklist_apps_source_id > 0)
return; return;
/* Use a timeout to batch multiple quick changes into a single /* Use a timeout to batch multiple quick changes into a single
* update. 1 second is an arbitrary sufficiently small number */ * update. 1 second is an arbitrary sufficiently small number */
self->blacklist_apps_source_id = g_timeout_add_seconds (1, blacklist_apps_cb, self); self->blocklist_apps_source_id = g_timeout_add_seconds (1, blocklist_apps_cb, self);
} }
static void static void
flush_update_blacklisted_apps (MctUserControls *self) flush_update_blocklisted_apps (MctUserControls *self)
{ {
if (self->blacklist_apps_source_id > 0) if (self->blocklist_apps_source_id > 0)
{ {
/* Remove the timer and forcefully call the timer callback. */ /* Remove the timer and forcefully call the timer callback. */
g_source_remove (self->blacklist_apps_source_id); g_source_remove (self->blocklist_apps_source_id);
self->blacklist_apps_source_id = 0; self->blocklist_apps_source_id = 0;
blacklist_apps_cb (self); blocklist_apps_cb (self);
} }
} }
@ -560,14 +560,14 @@ setup_parental_control_settings (MctUserControls *self)
/* Callbacks */ /* Callbacks */
static gboolean static gboolean
blacklist_apps_cb (gpointer data) blocklist_apps_cb (gpointer data)
{ {
g_auto(MctAppFilterBuilder) builder = MCT_APP_FILTER_BUILDER_INIT (); g_auto(MctAppFilterBuilder) builder = MCT_APP_FILTER_BUILDER_INIT ();
g_autoptr(MctAppFilter) new_filter = NULL; g_autoptr(MctAppFilter) new_filter = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
MctUserControls *self = data; MctUserControls *self = data;
self->blacklist_apps_source_id = 0; self->blocklist_apps_source_id = 0;
if (self->user == NULL) if (self->user == NULL)
{ {
@ -615,7 +615,7 @@ on_restrict_installation_switch_active_changed_cb (GtkSwitch *s,
} }
/* Save the changes. */ /* Save the changes. */
schedule_update_blacklisted_apps (self); schedule_update_blocklisted_apps (self);
} }
static void static void
@ -624,7 +624,7 @@ on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch *s,
MctUserControls *self) MctUserControls *self)
{ {
/* Save the changes. */ /* Save the changes. */
schedule_update_blacklisted_apps (self); schedule_update_blocklisted_apps (self);
} }
static void static void
@ -660,7 +660,7 @@ on_restrict_applications_dialog_delete_event_cb (GtkWidget *widget,
gtk_widget_hide (GTK_WIDGET (self->restrict_applications_dialog)); gtk_widget_hide (GTK_WIDGET (self->restrict_applications_dialog));
/* Schedule an update to the saved state. */ /* Schedule an update to the saved state. */
schedule_update_blacklisted_apps (self); schedule_update_blocklisted_apps (self);
return TRUE; return TRUE;
} }
@ -728,7 +728,7 @@ on_set_age_action_activated (GSimpleAction *action,
self->selected_age = age; self->selected_age = age;
schedule_update_blacklisted_apps (self); schedule_update_blocklisted_apps (self);
} }
static void static void
@ -783,7 +783,7 @@ mct_user_controls_finalize (GObject *object)
{ {
MctUserControls *self = (MctUserControls *)object; MctUserControls *self = (MctUserControls *)object;
g_assert (self->blacklist_apps_source_id == 0); g_assert (self->blocklist_apps_source_id == 0);
g_cancellable_cancel (self->cancellable); g_cancellable_cancel (self->cancellable);
g_clear_object (&self->action_group); g_clear_object (&self->action_group);
@ -823,7 +823,7 @@ mct_user_controls_dispose (GObject *object)
* do it multiple times, and after the first g_object_run_dispose() call, * do it multiple times, and after the first g_object_run_dispose() call,
* none of our child widgets are still around to extract data from anyway. */ * none of our child widgets are still around to extract data from anyway. */
if (!self->flushed_on_dispose) if (!self->flushed_on_dispose)
flush_update_blacklisted_apps (self); flush_update_blocklisted_apps (self);
self->flushed_on_dispose = TRUE; self->flushed_on_dispose = TRUE;
G_OBJECT_CLASS (mct_user_controls_parent_class)->dispose (object); G_OBJECT_CLASS (mct_user_controls_parent_class)->dispose (object);
@ -1171,7 +1171,7 @@ mct_user_controls_set_user (MctUserControls *self,
/* If we have pending unsaved changes from the previous user, force them to be /* If we have pending unsaved changes from the previous user, force them to be
* saved first. */ * saved first. */
flush_update_blacklisted_apps (self); flush_update_blocklisted_apps (self);
old_user = (self->user != NULL) ? g_object_ref (self->user) : NULL; old_user = (self->user != NULL) ? g_object_ref (self->user) : NULL;
@ -1314,7 +1314,7 @@ mct_user_controls_set_app_filter (MctUserControls *self,
/* If we have pending unsaved changes from the previous configuration, force /* If we have pending unsaved changes from the previous configuration, force
* them to be saved first. */ * them to be saved first. */
flush_update_blacklisted_apps (self); flush_update_blocklisted_apps (self);
if (self->filter == app_filter) if (self->filter == app_filter)
return; return;
@ -1363,7 +1363,7 @@ mct_user_controls_set_user_account_type (MctUserControls *self,
/* If we have pending unsaved changes from the previous user, force them to be /* If we have pending unsaved changes from the previous user, force them to be
* saved first. */ * saved first. */
flush_update_blacklisted_apps (self); flush_update_blocklisted_apps (self);
if (self->user_account_type == user_account_type) if (self->user_account_type == user_account_type)
return; return;
@ -1414,7 +1414,7 @@ mct_user_controls_set_user_locale (MctUserControls *self,
/* If we have pending unsaved changes from the previous user, force them to be /* If we have pending unsaved changes from the previous user, force them to be
* saved first. */ * saved first. */
flush_update_blacklisted_apps (self); flush_update_blocklisted_apps (self);
if (g_strcmp0 (self->user_locale, user_locale) == 0) if (g_strcmp0 (self->user_locale, user_locale) == 0)
return; return;
@ -1466,7 +1466,7 @@ mct_user_controls_set_user_display_name (MctUserControls *self,
/* If we have pending unsaved changes from the previous user, force them to be /* If we have pending unsaved changes from the previous user, force them to be
* saved first. */ * saved first. */
flush_update_blacklisted_apps (self); flush_update_blocklisted_apps (self);
if (g_strcmp0 (self->user_display_name, user_display_name) == 0) if (g_strcmp0 (self->user_display_name, user_display_name) == 0)
return; return;
@ -1504,9 +1504,9 @@ mct_user_controls_build_app_filter (MctUserControls *self,
g_debug ("Building parental controls settings…"); g_debug ("Building parental controls settings…");
/* Blacklist */ /* Blocklist */
g_debug ("\t → Blacklisting apps"); g_debug ("\t → Blocklisting apps");
mct_restrict_applications_dialog_build_app_filter (self->restrict_applications_dialog, builder); mct_restrict_applications_dialog_build_app_filter (self->restrict_applications_dialog, builder);
@ -1536,7 +1536,7 @@ mct_user_controls_build_app_filter (MctUserControls *self,
g_debug ("\t → %s web browsers", restrict_web_browsers ? "Restricting" : "Allowing"); g_debug ("\t → %s web browsers", restrict_web_browsers ? "Restricting" : "Allowing");
if (restrict_web_browsers) if (restrict_web_browsers)
mct_app_filter_builder_blacklist_content_type (builder, WEB_BROWSERS_CONTENT_TYPE); mct_app_filter_builder_blocklist_content_type (builder, WEB_BROWSERS_CONTENT_TYPE);
/* App installation */ /* App installation */
if (self->user_account_type != ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) if (self->user_account_type != ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR)

View File

@ -31,9 +31,9 @@ G_BEGIN_DECLS
/** /**
* MctAppFilterListType: * MctAppFilterListType:
* @MCT_APP_FILTER_LIST_BLACKLIST: Any program in the list is not allowed to * @MCT_APP_FILTER_LIST_BLOCKLIST: Any program in the list is not allowed to
* be run. * be run.
* @MCT_APP_FILTER_LIST_WHITELIST: Any program not in the list is not allowed * @MCT_APP_FILTER_LIST_ALLOWLIST: Any program not in the list is not allowed
* to be run. * to be run.
* *
* Different semantics for interpreting an application list. * Different semantics for interpreting an application list.
@ -42,8 +42,8 @@ G_BEGIN_DECLS
*/ */
typedef enum typedef enum
{ {
MCT_APP_FILTER_LIST_BLACKLIST, MCT_APP_FILTER_LIST_BLOCKLIST,
MCT_APP_FILTER_LIST_WHITELIST, MCT_APP_FILTER_LIST_ALLOWLIST,
} MctAppFilterListType; } MctAppFilterListType;
struct _MctAppFilter struct _MctAppFilter

View File

@ -164,9 +164,9 @@ mct_app_filter_is_enabled (MctAppFilter *filter)
/* Check all fields against their default values. Ignore /* Check all fields against their default values. Ignore
* `allow_system_installation` since its false by default, so the default * `allow_system_installation` since its false by default, so the default
* value is already the most restrictive. */ * value is already the most restrictive. */
return ((filter->app_list_type == MCT_APP_FILTER_LIST_BLACKLIST && return ((filter->app_list_type == MCT_APP_FILTER_LIST_BLOCKLIST &&
filter->app_list[0] != NULL) || filter->app_list[0] != NULL) ||
filter->app_list_type == MCT_APP_FILTER_LIST_WHITELIST || filter->app_list_type == MCT_APP_FILTER_LIST_ALLOWLIST ||
!oars_ratings_all_intense_or_unknown || !oars_ratings_all_intense_or_unknown ||
!filter->allow_user_installation); !filter->allow_user_installation);
} }
@ -202,9 +202,9 @@ mct_app_filter_is_path_allowed (MctAppFilter *filter,
switch (filter->app_list_type) switch (filter->app_list_type)
{ {
case MCT_APP_FILTER_LIST_BLACKLIST: case MCT_APP_FILTER_LIST_BLOCKLIST:
return !path_in_list; return !path_in_list;
case MCT_APP_FILTER_LIST_WHITELIST: case MCT_APP_FILTER_LIST_ALLOWLIST:
return path_in_list; return path_in_list;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
@ -265,9 +265,9 @@ mct_app_filter_is_flatpak_ref_allowed (MctAppFilter *filter,
switch (filter->app_list_type) switch (filter->app_list_type)
{ {
case MCT_APP_FILTER_LIST_BLACKLIST: case MCT_APP_FILTER_LIST_BLOCKLIST:
return !ref_in_list; return !ref_in_list;
case MCT_APP_FILTER_LIST_WHITELIST: case MCT_APP_FILTER_LIST_ALLOWLIST:
return ref_in_list; return ref_in_list;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
@ -281,7 +281,7 @@ mct_app_filter_is_flatpak_ref_allowed (MctAppFilter *filter,
* *
* Check whether the flatpak app with the given @app_id is allowed to be run * Check whether the flatpak app with the given @app_id is allowed to be run
* according to this app filter. This is a globbing match, matching @app_id * according to this app filter. This is a globbing match, matching @app_id
* against potentially multiple entries in the blacklist, as the blacklist * against potentially multiple entries in the blocklist, as the blocklist
* contains flatpak refs (for example, `app/org.gnome.Builder/x86_64/master`) * contains flatpak refs (for example, `app/org.gnome.Builder/x86_64/master`)
* which contain architecture and branch information. App IDs (for example, * which contain architecture and branch information. App IDs (for example,
* `org.gnome.Builder`) do not contain architecture or branch information. * `org.gnome.Builder`) do not contain architecture or branch information.
@ -315,9 +315,9 @@ mct_app_filter_is_flatpak_app_allowed (MctAppFilter *filter,
switch (filter->app_list_type) switch (filter->app_list_type)
{ {
case MCT_APP_FILTER_LIST_BLACKLIST: case MCT_APP_FILTER_LIST_BLOCKLIST:
return !id_in_list; return !id_in_list;
case MCT_APP_FILTER_LIST_WHITELIST: case MCT_APP_FILTER_LIST_ALLOWLIST:
return id_in_list; return id_in_list;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
@ -431,8 +431,8 @@ is_valid_content_type (const gchar *content_type)
* according to this app filter. * according to this app filter.
* *
* Note that this method doesnt match content subtypes. For example, if * Note that this method doesnt match content subtypes. For example, if
* `application/xml` is added to the blacklist but `application/xspf+xml` is not, * `application/xml` is added to the blocklist but `application/xspf+xml` is not,
* a check for whether `application/xspf+xml` is blacklisted would return false. * a check for whether `application/xspf+xml` is blocklisted would return false.
* *
* Returns: %TRUE if the user this @filter corresponds to is allowed to run * Returns: %TRUE if the user this @filter corresponds to is allowed to run
* programs handling @content_type according to the @filter policy; * programs handling @content_type according to the @filter policy;
@ -453,9 +453,9 @@ mct_app_filter_is_content_type_allowed (MctAppFilter *filter,
switch (filter->app_list_type) switch (filter->app_list_type)
{ {
case MCT_APP_FILTER_LIST_BLACKLIST: case MCT_APP_FILTER_LIST_BLOCKLIST:
return !ref_in_list; return !ref_in_list;
case MCT_APP_FILTER_LIST_WHITELIST: case MCT_APP_FILTER_LIST_ALLOWLIST:
return ref_in_list; return ref_in_list;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
@ -606,7 +606,7 @@ _mct_app_filter_build_app_filter_variant (MctAppFilter *filter)
g_return_val_if_fail (filter->ref_count >= 1, NULL); g_return_val_if_fail (filter->ref_count >= 1, NULL);
g_variant_builder_add (&builder, "b", g_variant_builder_add (&builder, "b",
(filter->app_list_type == MCT_APP_FILTER_LIST_WHITELIST)); (filter->app_list_type == MCT_APP_FILTER_LIST_ALLOWLIST));
g_variant_builder_open (&builder, G_VARIANT_TYPE ("as")); g_variant_builder_open (&builder, G_VARIANT_TYPE ("as"));
for (gsize i = 0; filter->app_list[i] != NULL; i++) for (gsize i = 0; filter->app_list[i] != NULL; i++)
@ -675,7 +675,7 @@ mct_app_filter_deserialize (GVariant *variant,
uid_t user_id, uid_t user_id,
GError **error) GError **error)
{ {
gboolean is_whitelist; gboolean is_allowlist;
g_auto(GStrv) app_list = NULL; g_auto(GStrv) app_list = NULL;
const gchar *content_rating_kind; const gchar *content_rating_kind;
g_autoptr(GVariant) oars_variant = NULL; g_autoptr(GVariant) oars_variant = NULL;
@ -700,10 +700,10 @@ mct_app_filter_deserialize (GVariant *variant,
* kept in sync with those in the `com.endlessm.ParentalControls.AppFilter` * kept in sync with those in the `com.endlessm.ParentalControls.AppFilter`
* D-Bus interface. */ * D-Bus interface. */
if (!g_variant_lookup (variant, "AppFilter", "(b^as)", if (!g_variant_lookup (variant, "AppFilter", "(b^as)",
&is_whitelist, &app_list)) &is_allowlist, &app_list))
{ {
/* Default value. */ /* Default value. */
is_whitelist = FALSE; is_allowlist = FALSE;
app_list = g_new0 (gchar *, 1); app_list = g_new0 (gchar *, 1);
} }
@ -747,7 +747,7 @@ mct_app_filter_deserialize (GVariant *variant,
app_filter->user_id = user_id; app_filter->user_id = user_id;
app_filter->app_list = g_steal_pointer (&app_list); app_filter->app_list = g_steal_pointer (&app_list);
app_filter->app_list_type = app_filter->app_list_type =
is_whitelist ? MCT_APP_FILTER_LIST_WHITELIST : MCT_APP_FILTER_LIST_BLACKLIST; is_allowlist ? MCT_APP_FILTER_LIST_ALLOWLIST : MCT_APP_FILTER_LIST_BLOCKLIST;
app_filter->oars_ratings = g_steal_pointer (&oars_variant); app_filter->oars_ratings = g_steal_pointer (&oars_variant);
app_filter->allow_user_installation = allow_user_installation; app_filter->allow_user_installation = allow_user_installation;
app_filter->allow_system_installation = allow_system_installation; app_filter->allow_system_installation = allow_system_installation;
@ -762,7 +762,7 @@ mct_app_filter_deserialize (GVariant *variant,
*/ */
typedef struct typedef struct
{ {
GPtrArray *blacklist; /* (nullable) (owned) (element-type utf8) */ GPtrArray *blocklist; /* (nullable) (owned) (element-type utf8) */
GHashTable *oars; /* (nullable) (owned) (element-type utf8 MctAppFilterOarsValue) */ GHashTable *oars; /* (nullable) (owned) (element-type utf8 MctAppFilterOarsValue) */
gboolean allow_user_installation; gboolean allow_user_installation;
gboolean allow_system_installation; gboolean allow_system_installation;
@ -800,7 +800,7 @@ mct_app_filter_builder_init (MctAppFilterBuilder *builder)
MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder; MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder;
g_return_if_fail (_builder != NULL); g_return_if_fail (_builder != NULL);
g_return_if_fail (_builder->blacklist == NULL); g_return_if_fail (_builder->blocklist == NULL);
g_return_if_fail (_builder->oars == NULL); g_return_if_fail (_builder->oars == NULL);
memcpy (builder, &local_builder, sizeof (local_builder)); memcpy (builder, &local_builder, sizeof (local_builder));
@ -826,7 +826,7 @@ mct_app_filter_builder_clear (MctAppFilterBuilder *builder)
g_return_if_fail (_builder != NULL); g_return_if_fail (_builder != NULL);
g_clear_pointer (&_builder->blacklist, g_ptr_array_unref); g_clear_pointer (&_builder->blocklist, g_ptr_array_unref);
g_clear_pointer (&_builder->oars, g_hash_table_unref); g_clear_pointer (&_builder->oars, g_hash_table_unref);
} }
@ -876,8 +876,8 @@ mct_app_filter_builder_copy (MctAppFilterBuilder *builder)
_copy = (MctAppFilterBuilderReal *) copy; _copy = (MctAppFilterBuilderReal *) copy;
mct_app_filter_builder_clear (copy); mct_app_filter_builder_clear (copy);
if (_builder->blacklist != NULL) if (_builder->blocklist != NULL)
_copy->blacklist = g_ptr_array_ref (_builder->blacklist); _copy->blocklist = g_ptr_array_ref (_builder->blocklist);
if (_builder->oars != NULL) if (_builder->oars != NULL)
_copy->oars = g_hash_table_ref (_builder->oars); _copy->oars = g_hash_table_ref (_builder->oars);
_copy->allow_user_installation = _builder->allow_user_installation; _copy->allow_user_installation = _builder->allow_user_installation;
@ -927,11 +927,11 @@ mct_app_filter_builder_end (MctAppFilterBuilder *builder)
g_autoptr(GVariant) oars_variant = NULL; g_autoptr(GVariant) oars_variant = NULL;
g_return_val_if_fail (_builder != NULL, NULL); g_return_val_if_fail (_builder != NULL, NULL);
g_return_val_if_fail (_builder->blacklist != NULL, NULL); g_return_val_if_fail (_builder->blocklist != NULL, NULL);
g_return_val_if_fail (_builder->oars != NULL, NULL); g_return_val_if_fail (_builder->oars != NULL, NULL);
/* Ensure the paths list is %NULL-terminated. */ /* Ensure the paths list is %NULL-terminated. */
g_ptr_array_add (_builder->blacklist, NULL); g_ptr_array_add (_builder->blocklist, NULL);
/* Build the OARS variant. */ /* Build the OARS variant. */
g_hash_table_iter_init (&iter, _builder->oars); g_hash_table_iter_init (&iter, _builder->oars);
@ -962,8 +962,8 @@ mct_app_filter_builder_end (MctAppFilterBuilder *builder)
app_filter = g_new0 (MctAppFilter, 1); app_filter = g_new0 (MctAppFilter, 1);
app_filter->ref_count = 1; app_filter->ref_count = 1;
app_filter->user_id = -1; app_filter->user_id = -1;
app_filter->app_list = (gchar **) g_ptr_array_free (g_steal_pointer (&_builder->blacklist), FALSE); app_filter->app_list = (gchar **) g_ptr_array_free (g_steal_pointer (&_builder->blocklist), FALSE);
app_filter->app_list_type = MCT_APP_FILTER_LIST_BLACKLIST; app_filter->app_list_type = MCT_APP_FILTER_LIST_BLOCKLIST;
app_filter->oars_ratings = g_steal_pointer (&oars_variant); app_filter->oars_ratings = g_steal_pointer (&oars_variant);
app_filter->allow_user_installation = _builder->allow_user_installation; app_filter->allow_user_installation = _builder->allow_user_installation;
app_filter->allow_system_installation = _builder->allow_system_installation; app_filter->allow_system_installation = _builder->allow_system_installation;
@ -974,24 +974,24 @@ mct_app_filter_builder_end (MctAppFilterBuilder *builder)
} }
/** /**
* mct_app_filter_builder_blacklist_path: * mct_app_filter_builder_blocklist_path:
* @builder: an initialised #MctAppFilterBuilder * @builder: an initialised #MctAppFilterBuilder
* @path: (type filename): an absolute path to blacklist * @path: (type filename): an absolute path to blocklist
* *
* Add @path to the blacklist of app paths in the filter under construction. It * Add @path to the blocklist of app paths in the filter under construction. It
* will be canonicalised (without doing any I/O) before being added. * will be canonicalised (without doing any I/O) before being added.
* The canonicalised @path will not be added again if its already been added. * The canonicalised @path will not be added again if its already been added.
* *
* Since: 0.2.0 * Since: 0.2.0
*/ */
void void
mct_app_filter_builder_blacklist_path (MctAppFilterBuilder *builder, mct_app_filter_builder_blocklist_path (MctAppFilterBuilder *builder,
const gchar *path) const gchar *path)
{ {
MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder; MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder;
g_return_if_fail (_builder != NULL); g_return_if_fail (_builder != NULL);
g_return_if_fail (_builder->blacklist != NULL); g_return_if_fail (_builder->blocklist != NULL);
g_return_if_fail (path != NULL); g_return_if_fail (path != NULL);
g_return_if_fail (g_path_is_absolute (path)); g_return_if_fail (g_path_is_absolute (path));
@ -1000,67 +1000,67 @@ mct_app_filter_builder_blacklist_path (MctAppFilterBuilder *builder,
NULL, NULL, NULL); NULL, NULL, NULL);
g_return_if_fail (canonical_path_utf8 != NULL); g_return_if_fail (canonical_path_utf8 != NULL);
if (!g_ptr_array_find_with_equal_func (_builder->blacklist, if (!g_ptr_array_find_with_equal_func (_builder->blocklist,
canonical_path_utf8, g_str_equal, NULL)) canonical_path_utf8, g_str_equal, NULL))
g_ptr_array_add (_builder->blacklist, g_steal_pointer (&canonical_path_utf8)); g_ptr_array_add (_builder->blocklist, g_steal_pointer (&canonical_path_utf8));
} }
/** /**
* mct_app_filter_builder_blacklist_flatpak_ref: * mct_app_filter_builder_blocklist_flatpak_ref:
* @builder: an initialised #MctAppFilterBuilder * @builder: an initialised #MctAppFilterBuilder
* @app_ref: a flatpak app ref to blacklist * @app_ref: a flatpak app ref to blocklist
* *
* Add @app_ref to the blacklist of flatpak refs in the filter under * Add @app_ref to the blocklist of flatpak refs in the filter under
* construction. The @app_ref will not be added again if its already been * construction. The @app_ref will not be added again if its already been
* added. * added.
* *
* Since: 0.2.0 * Since: 0.2.0
*/ */
void void
mct_app_filter_builder_blacklist_flatpak_ref (MctAppFilterBuilder *builder, mct_app_filter_builder_blocklist_flatpak_ref (MctAppFilterBuilder *builder,
const gchar *app_ref) const gchar *app_ref)
{ {
MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder; MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder;
g_return_if_fail (_builder != NULL); g_return_if_fail (_builder != NULL);
g_return_if_fail (_builder->blacklist != NULL); g_return_if_fail (_builder->blocklist != NULL);
g_return_if_fail (app_ref != NULL); g_return_if_fail (app_ref != NULL);
g_return_if_fail (is_valid_flatpak_ref (app_ref)); g_return_if_fail (is_valid_flatpak_ref (app_ref));
if (!g_ptr_array_find_with_equal_func (_builder->blacklist, if (!g_ptr_array_find_with_equal_func (_builder->blocklist,
app_ref, g_str_equal, NULL)) app_ref, g_str_equal, NULL))
g_ptr_array_add (_builder->blacklist, g_strdup (app_ref)); g_ptr_array_add (_builder->blocklist, g_strdup (app_ref));
} }
/** /**
* mct_app_filter_builder_blacklist_content_type: * mct_app_filter_builder_blocklist_content_type:
* @builder: an initialised #MctAppFilterBuilder * @builder: an initialised #MctAppFilterBuilder
* @content_type: a content type to blacklist * @content_type: a content type to blocklist
* *
* Add @content_type to the blacklist of content types in the filter under * Add @content_type to the blocklist of content types in the filter under
* construction. The @content_type will not be added again if its already been * construction. The @content_type will not be added again if its already been
* added. * added.
* *
* Note that this method doesnt handle content subtypes. For example, if * Note that this method doesnt handle content subtypes. For example, if
* `application/xml` is added to the blacklist but `application/xspf+xml` is not, * `application/xml` is added to the blocklist but `application/xspf+xml` is not,
* a check for whether `application/xspf+xml` is blacklisted would return false. * a check for whether `application/xspf+xml` is blocklisted would return false.
* *
* Since: 0.4.0 * Since: 0.4.0
*/ */
void void
mct_app_filter_builder_blacklist_content_type (MctAppFilterBuilder *builder, mct_app_filter_builder_blocklist_content_type (MctAppFilterBuilder *builder,
const gchar *content_type) const gchar *content_type)
{ {
MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder; MctAppFilterBuilderReal *_builder = (MctAppFilterBuilderReal *) builder;
g_return_if_fail (_builder != NULL); g_return_if_fail (_builder != NULL);
g_return_if_fail (_builder->blacklist != NULL); g_return_if_fail (_builder->blocklist != NULL);
g_return_if_fail (content_type != NULL); g_return_if_fail (content_type != NULL);
g_return_if_fail (is_valid_content_type (content_type)); g_return_if_fail (is_valid_content_type (content_type));
if (!g_ptr_array_find_with_equal_func (_builder->blacklist, if (!g_ptr_array_find_with_equal_func (_builder->blocklist,
content_type, g_str_equal, NULL)) content_type, g_str_equal, NULL))
g_ptr_array_add (_builder->blacklist, g_strdup (content_type)); g_ptr_array_add (_builder->blocklist, g_strdup (content_type));
} }
/** /**

View File

@ -165,11 +165,11 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (MctAppFilterBuilder, mct_app_filter_builder_free)
MctAppFilter *mct_app_filter_builder_end (MctAppFilterBuilder *builder); MctAppFilter *mct_app_filter_builder_end (MctAppFilterBuilder *builder);
void mct_app_filter_builder_blacklist_path (MctAppFilterBuilder *builder, void mct_app_filter_builder_blocklist_path (MctAppFilterBuilder *builder,
const gchar *path); const gchar *path);
void mct_app_filter_builder_blacklist_flatpak_ref (MctAppFilterBuilder *builder, void mct_app_filter_builder_blocklist_flatpak_ref (MctAppFilterBuilder *builder,
const gchar *app_ref); const gchar *app_ref);
void mct_app_filter_builder_blacklist_content_type (MctAppFilterBuilder *builder, void mct_app_filter_builder_blocklist_content_type (MctAppFilterBuilder *builder,
const gchar *content_type); const gchar *content_type);
void mct_app_filter_builder_set_oars_value (MctAppFilterBuilder *builder, void mct_app_filter_builder_set_oars_value (MctAppFilterBuilder *builder,

View File

@ -275,13 +275,13 @@ test_app_filter_builder_non_empty (BuilderFixture *fixture,
g_autoptr(MctAppFilter) filter = NULL; g_autoptr(MctAppFilter) filter = NULL;
g_autofree const gchar **sections = NULL; g_autofree const gchar **sections = NULL;
mct_app_filter_builder_blacklist_path (fixture->builder, "/bin/true"); mct_app_filter_builder_blocklist_path (fixture->builder, "/bin/true");
mct_app_filter_builder_blacklist_path (fixture->builder, "/usr/bin/gnome-software"); mct_app_filter_builder_blocklist_path (fixture->builder, "/usr/bin/gnome-software");
mct_app_filter_builder_blacklist_flatpak_ref (fixture->builder, mct_app_filter_builder_blocklist_flatpak_ref (fixture->builder,
"app/org.doom.Doom/x86_64/master"); "app/org.doom.Doom/x86_64/master");
mct_app_filter_builder_blacklist_content_type (fixture->builder, mct_app_filter_builder_blocklist_content_type (fixture->builder,
"x-scheme-handler/http"); "x-scheme-handler/http");
mct_app_filter_builder_set_oars_value (fixture->builder, "drugs-alcohol", mct_app_filter_builder_set_oars_value (fixture->builder, "drugs-alcohol",
@ -380,8 +380,8 @@ test_app_filter_builder_copy_empty (void)
builder_copy = mct_app_filter_builder_copy (builder); builder_copy = mct_app_filter_builder_copy (builder);
mct_app_filter_builder_init (builder_copy); mct_app_filter_builder_init (builder_copy);
mct_app_filter_builder_blacklist_path (builder_copy, "/bin/true"); mct_app_filter_builder_blocklist_path (builder_copy, "/bin/true");
mct_app_filter_builder_blacklist_content_type (builder_copy, mct_app_filter_builder_blocklist_content_type (builder_copy,
"x-scheme-handler/http"); "x-scheme-handler/http");
filter = mct_app_filter_builder_end (builder_copy); filter = mct_app_filter_builder_end (builder_copy);
@ -405,8 +405,8 @@ test_app_filter_builder_copy_full (void)
g_autoptr(MctAppFilterBuilder) builder_copy = NULL; g_autoptr(MctAppFilterBuilder) builder_copy = NULL;
g_autoptr(MctAppFilter) filter = NULL; g_autoptr(MctAppFilter) filter = NULL;
mct_app_filter_builder_blacklist_path (builder, "/bin/true"); mct_app_filter_builder_blocklist_path (builder, "/bin/true");
mct_app_filter_builder_blacklist_content_type (builder, mct_app_filter_builder_blocklist_content_type (builder,
"x-scheme-handler/http"); "x-scheme-handler/http");
mct_app_filter_builder_set_allow_user_installation (builder, FALSE); mct_app_filter_builder_set_allow_user_installation (builder, FALSE);
mct_app_filter_builder_set_allow_system_installation (builder, TRUE); mct_app_filter_builder_set_allow_system_installation (builder, TRUE);
@ -545,9 +545,9 @@ test_app_filter_appinfo (void)
"MimeType=x-scheme-handler/http\n" }, "MimeType=x-scheme-handler/http\n" },
}; };
mct_app_filter_builder_blacklist_path (&builder, "/bin/false"); mct_app_filter_builder_blocklist_path (&builder, "/bin/false");
mct_app_filter_builder_blacklist_flatpak_ref (&builder, "app/org.gnome.Nasty/x86_64/stable"); mct_app_filter_builder_blocklist_flatpak_ref (&builder, "app/org.gnome.Nasty/x86_64/stable");
mct_app_filter_builder_blacklist_content_type (&builder, "x-scheme-handler/http"); mct_app_filter_builder_blocklist_content_type (&builder, "x-scheme-handler/http");
filter = mct_app_filter_builder_end (&builder); filter = mct_app_filter_builder_end (&builder);
@ -751,13 +751,13 @@ test_app_filter_bus_get (BusFixture *fixture,
g_assert_true (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Chess")); g_assert_true (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Chess"));
} }
/* Test that getting an #MctAppFilter containing a whitelist from the mock D-Bus /* Test that getting an #MctAppFilter containing a allowlist from the mock D-Bus
* service works, and that the #MctAppFilter methods handle the whitelist * service works, and that the #MctAppFilter methods handle the allowlist
* correctly. * correctly.
* *
* The mock D-Bus replies are generated in get_app_filter_server_cb(). */ * The mock D-Bus replies are generated in get_app_filter_server_cb(). */
static void static void
test_app_filter_bus_get_whitelist (BusFixture *fixture, test_app_filter_bus_get_allowlist (BusFixture *fixture,
gconstpointer test_data) gconstpointer test_data)
{ {
g_autoptr(MctAppFilter) app_filter = NULL; g_autoptr(MctAppFilter) app_filter = NULL;
@ -769,8 +769,8 @@ test_app_filter_bus_get_whitelist (BusFixture *fixture,
"'AllowUserInstallation': <true>," "'AllowUserInstallation': <true>,"
"'AllowSystemInstallation': <true>," "'AllowSystemInstallation': <true>,"
"'AppFilter': <(true, [" "'AppFilter': <(true, ["
"'app/org.gnome.Whitelisted1/x86_64/stable'," "'app/org.gnome.Allowlisted1/x86_64/stable',"
"'app/org.gnome.Whitelisted2/x86_64/stable'," "'app/org.gnome.Allowlisted2/x86_64/stable',"
"'/usr/bin/true'," "'/usr/bin/true',"
"'text/plain'" "'text/plain'"
"])>," "])>,"
@ -789,15 +789,15 @@ test_app_filter_bus_get_whitelist (BusFixture *fixture,
g_assert_no_error (local_error); g_assert_no_error (local_error);
g_assert_nonnull (app_filter); g_assert_nonnull (app_filter);
/* Check the app filter properties. The returned filter is a whitelist, /* Check the app filter properties. The returned filter is a allowlist,
* whereas typically a blacklist is returned. */ * whereas typically a blocklist is returned. */
g_assert_cmpuint (mct_app_filter_get_user_id (app_filter), ==, fixture->valid_uid); g_assert_cmpuint (mct_app_filter_get_user_id (app_filter), ==, fixture->valid_uid);
g_assert_true (mct_app_filter_is_enabled (app_filter)); g_assert_true (mct_app_filter_is_enabled (app_filter));
g_assert_false (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Builder")); g_assert_false (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Builder"));
g_assert_true (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Whitelisted1")); g_assert_true (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Allowlisted1"));
g_assert_true (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Whitelisted2")); g_assert_true (mct_app_filter_is_flatpak_app_allowed (app_filter, "org.gnome.Allowlisted2"));
g_assert_true (mct_app_filter_is_flatpak_ref_allowed (app_filter, "app/org.gnome.Whitelisted1/x86_64/stable")); g_assert_true (mct_app_filter_is_flatpak_ref_allowed (app_filter, "app/org.gnome.Allowlisted1/x86_64/stable"));
g_assert_false (mct_app_filter_is_flatpak_ref_allowed (app_filter, "app/org.gnome.Whitelisted1/x86_64/unknown")); g_assert_false (mct_app_filter_is_flatpak_ref_allowed (app_filter, "app/org.gnome.Allowlisted1/x86_64/unknown"));
g_assert_true (mct_app_filter_is_path_allowed (app_filter, "/usr/bin/true")); g_assert_true (mct_app_filter_is_path_allowed (app_filter, "/usr/bin/true"));
g_assert_false (mct_app_filter_is_path_allowed (app_filter, "/usr/bin/false")); g_assert_false (mct_app_filter_is_path_allowed (app_filter, "/usr/bin/false"));
g_assert_true (mct_app_filter_is_content_type_allowed (app_filter, g_assert_true (mct_app_filter_is_content_type_allowed (app_filter,
@ -1300,10 +1300,10 @@ test_app_filter_bus_set (BusFixture *fixture,
}; };
/* Build an app filter. */ /* Build an app filter. */
mct_app_filter_builder_blacklist_path (&builder, "/usr/bin/false"); mct_app_filter_builder_blocklist_path (&builder, "/usr/bin/false");
mct_app_filter_builder_blacklist_path (&builder, "/usr/bin/banned"); mct_app_filter_builder_blocklist_path (&builder, "/usr/bin/banned");
mct_app_filter_builder_blacklist_flatpak_ref (&builder, "app/org.gnome.Nasty/x86_64/stable"); mct_app_filter_builder_blocklist_flatpak_ref (&builder, "app/org.gnome.Nasty/x86_64/stable");
mct_app_filter_builder_blacklist_content_type (&builder, "x-scheme-handler/http"); mct_app_filter_builder_blocklist_content_type (&builder, "x-scheme-handler/http");
mct_app_filter_builder_set_oars_value (&builder, "violence-fantasy", MCT_APP_FILTER_OARS_VALUE_INTENSE); mct_app_filter_builder_set_oars_value (&builder, "violence-fantasy", MCT_APP_FILTER_OARS_VALUE_INTENSE);
mct_app_filter_builder_set_allow_user_installation (&builder, TRUE); mct_app_filter_builder_set_allow_user_installation (&builder, TRUE);
mct_app_filter_builder_set_allow_system_installation (&builder, TRUE); mct_app_filter_builder_set_allow_system_installation (&builder, TRUE);
@ -1552,8 +1552,8 @@ main (int argc,
bus_set_up, test_app_filter_bus_get, bus_tear_down); bus_set_up, test_app_filter_bus_get, bus_tear_down);
g_test_add ("/app-filter/bus/get/sync", BusFixture, GUINT_TO_POINTER (FALSE), g_test_add ("/app-filter/bus/get/sync", BusFixture, GUINT_TO_POINTER (FALSE),
bus_set_up, test_app_filter_bus_get, bus_tear_down); bus_set_up, test_app_filter_bus_get, bus_tear_down);
g_test_add ("/app-filter/bus/get/whitelist", BusFixture, NULL, g_test_add ("/app-filter/bus/get/allowlist", BusFixture, NULL,
bus_set_up, test_app_filter_bus_get_whitelist, bus_tear_down); bus_set_up, test_app_filter_bus_get_allowlist, bus_tear_down);
g_test_add ("/app-filter/bus/get/all-oars-values", BusFixture, NULL, g_test_add ("/app-filter/bus/get/all-oars-values", BusFixture, NULL,
bus_set_up, test_app_filter_bus_get_all_oars_values, bus_tear_down); bus_set_up, test_app_filter_bus_get_all_oars_values, bus_tear_down);
g_test_add ("/app-filter/bus/get/defaults", BusFixture, NULL, g_test_add ("/app-filter/bus/get/defaults", BusFixture, NULL,

View File

@ -385,12 +385,12 @@ def command_set_app_filter(user, allow_user_installation=True,
file=sys.stderr) file=sys.stderr)
raise SystemExit(EXIT_INVALID_OPTION) raise SystemExit(EXIT_INVALID_OPTION)
elif is_maybe_flatpak_ref: elif is_maybe_flatpak_ref:
builder.blacklist_flatpak_ref(arg) builder.blocklist_flatpak_ref(arg)
elif is_maybe_content_type: elif is_maybe_content_type:
builder.blacklist_content_type(arg) builder.blocklist_content_type(arg)
elif is_maybe_path: elif is_maybe_path:
path = os.path.abspath(arg) path = os.path.abspath(arg)
builder.blacklist_path(path) builder.blocklist_path(path)
else: else:
raise AssertionError('code should not be reached') raise AssertionError('code should not be reached')
@ -523,7 +523,7 @@ def main():
'flatpak repo') 'flatpak repo')
parser_set_app_filter.add_argument('app_filter_args', nargs='*', parser_set_app_filter.add_argument('app_filter_args', nargs='*',
help='paths, content types or flatpak ' help='paths, content types or flatpak '
'refs to blacklist and OARS ' 'refs to blocklist and OARS '
'section=value pairs to store') 'section=value pairs to store')
parser_set_app_filter.set_defaults(allow_user_installation=True, parser_set_app_filter.set_defaults(allow_user_installation=True,
allow_system_installation=False) allow_system_installation=False)