accounts-service: Add allow-user-installation setting

This controls whether the user can install to their user repository at
all; if it’s true (the default), then installation of apps is still
subject to the OARS filter.

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

https://phabricator.endlessm.com/T24457
This commit is contained in:
Philip Withnall 2018-11-29 21:09:57 +00:00
parent 3ec77740c7
commit 222b436a61
5 changed files with 133 additions and 4 deletions

View file

@ -125,6 +125,7 @@ test_app_filter_builder_non_empty (BuilderFixture *fixture,
EPC_APP_FILTER_OARS_VALUE_MILD);
epc_app_filter_builder_set_oars_value (fixture->builder, "language-humor",
EPC_APP_FILTER_OARS_VALUE_MODERATE);
epc_app_filter_builder_set_allow_user_installation (fixture->builder, TRUE);
epc_app_filter_builder_set_allow_system_installation (fixture->builder, FALSE);
filter = epc_app_filter_builder_end (fixture->builder);
@ -151,6 +152,7 @@ test_app_filter_builder_non_empty (BuilderFixture *fixture,
const gchar * const expected_sections[] = { "drugs-alcohol", "language-humor", NULL };
assert_strv_equal ((const gchar * const *) sections, expected_sections);
g_assert_true (epc_app_filter_is_user_installation_allowed (filter));
g_assert_false (epc_app_filter_is_system_installation_allowed (filter));
}
@ -186,6 +188,7 @@ test_app_filter_builder_empty (BuilderFixture *fixture,
const gchar * const expected_sections[] = { NULL };
assert_strv_equal ((const gchar * const *) sections, expected_sections);
g_assert_true (epc_app_filter_is_user_installation_allowed (filter));
g_assert_false (epc_app_filter_is_system_installation_allowed (filter));
}
@ -208,6 +211,7 @@ test_app_filter_builder_copy_empty (void)
g_assert_true (epc_app_filter_is_path_allowed (filter, "/bin/false"));
g_assert_false (epc_app_filter_is_path_allowed (filter, "/bin/true"));
g_assert_true (epc_app_filter_is_user_installation_allowed (filter));
g_assert_false (epc_app_filter_is_system_installation_allowed (filter));
}
@ -221,13 +225,15 @@ test_app_filter_builder_copy_full (void)
g_autoptr(EpcAppFilter) filter = NULL;
epc_app_filter_builder_blacklist_path (builder, "/bin/true");
epc_app_filter_builder_set_allow_system_installation (builder, FALSE);
epc_app_filter_builder_set_allow_user_installation (builder, FALSE);
epc_app_filter_builder_set_allow_system_installation (builder, TRUE);
builder_copy = epc_app_filter_builder_copy (builder);
filter = epc_app_filter_builder_end (builder_copy);
g_assert_true (epc_app_filter_is_path_allowed (filter, "/bin/false"));
g_assert_false (epc_app_filter_is_path_allowed (filter, "/bin/true"));
g_assert_false (epc_app_filter_is_system_installation_allowed (filter));
g_assert_false (epc_app_filter_is_user_installation_allowed (filter));
g_assert_true (epc_app_filter_is_system_installation_allowed (filter));
}
int