Commit Graph

12 Commits

Author SHA1 Message Date
Matthew Leeds 15e8a74b21 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.
2020-06-09 15:35:21 -07:00
Philip Withnall f106319fdd app-filter: Add mct_app_filter_is_enabled() API
This is a high-level API to indicate whether parental controls are
‘enabled’ for the given user. Specifically, whether any of the
properties of the `MctAppFilter` differ from their default value.

Includes tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-24 11:06:16 +00:00
Philip Withnall faa0b9a3eb app-filter: Factor out a helper function
This introduces no functional changes, but will make an upcoming change
a little simpler.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-24 11:06:16 +00:00
Philip Withnall cba851fc27 app-filter: Add serialize and deserialize methods
Add methods to serialise and deserialise the app filter, and use them to
replace the code in `MctManager` which was previously doing this. This
exposes the variant format for the app filter in the API (although the
format is described as ‘opaque’) so that user code can log it or store
it separately.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-18 10:40:27 +00:00
Philip Withnall 300b5a624f libmalcontent: Move MctAppFilterError to MctManagerError
This isn’t an API break, as compatibility defines are in place; and the
error code values are the same, so it shouldn’t be an ABI break. The
string value of the error quark has changed, but nobody should be
comparing that against a value which hasn’t come out of libmalcontent,
so changing it should be OK.

This is along the same lines as the previous commit: we don’t need one
error domain per property of an `MctManager`, so reduce the potential
for future duplication by renaming it now.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:17:45 +00:00
Andre Moreira Magalhaes da0e63fe99 libmalcontent: Add support for filtering by content type
This is useful for example if blacklisting all apps that can
handle certain content types is desired.

Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>
2019-06-14 15:55:27 +00:00
Andre Moreira Magalhaes bbd1b2bdff libmalcontent: Rename app filter paths_blacklist member to blacklist
The filter blacklist also holds information on flatpak refs that are
blacklisted (apart from paths), so lets rename it for clarity.

Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>
2019-06-14 15:55:27 +00:00
Philip Withnall 68ebe8b568 libmalcontent: Factor getting/setting app filter into a manager
Create a new MctManager object which is used as the anchor for getting
or setting MctAppFilters.

This changes the API naming around quite a bit, but doesn’t really
change its behaviour or functionality — see the tests for examples of
how little things change.

This is one step on the way to emitting a signal (from MctManager) when
a user’s parental controls change.

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

https://gitlab.freedesktop.org/pwithnall/malcontent/issues/1
2019-04-24 13:45:59 +01:00
Philip Withnall 9fb9b75b57 libmalcontent: Drop an unused variable
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-24 11:06:28 +01:00
Philip Withnall a378e28237 libmalcontent: Add MCT_APP_FILTER_ERROR_DISABLED error
This indicates that app filtering is disabled globally, perhaps because
it’s not installed in accountsservice properly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-24 11:06:28 +01:00
Philip Withnall 3f3bb6ee54 lib: Change allow_interactive_authorization bool to flags
This is an API break for the mct_{get,set}_app_filter() APIs, but makes
them a bit clearer to use, and a little more future proof.

This includes updates to all the tests and documentation.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-19 16:56:58 +00:00
Philip Withnall 03436eacf5 Rename project from eos-parental-controls to malcontent
Rename the library from libeos-parental-controls to libmalcontent, and
the client from eos-parental-controls-client to malcontent-client.

This was done using the following mechanical edits, and no other
changes:
```
git search-replace -f EPC///MCT
git search-replace -f Epc///Mct
git search-replace -f epc///mct
git search-replace -f eos_parental_controls///malcontent
git search-replace -f eos-parental-controls///malcontent
git search-replace -f EosParentalControls///Malcontent
git search-replace -f 'eos\\-parental\\-controls///malcontent'
git search-replace -f 'Since: 0.1.0///Since: 0.2.0'
```

Note that the accounts-service extension interface has *not* been
renamed, as that would revert people’s parental controls settings in
existing deployments.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-26 17:45:14 +00:00
Renamed from libeos-parental-controls/app-filter.c (Browse further)