Commit Graph

20 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 e16759e0f7 malcontent-client: Fix error when running with no arguments
The default value for the `user` argument wasn’t looked up, since
parsing an empty command line doesn’t go through the
`parser_get_app_filter` subparser.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:27:17 +00:00
Philip Withnall c02c56b3b5 malcontent-client: Add a `get-session-limits` command
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:17:45 +00:00
Philip Withnall a54415aa2c malcontent-client: Improve specificity of exit statuses
Add a couple of missing exit statuses (and document them) and convert
Malcontent errors to exit statuses more specifically.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:17:45 +00:00
Philip Withnall acf2738d56 libmalcontent: Rename flags types
If we have a flag type for getting and for setting every type of value
which can be stored on an `MctManager`, that will lead to a load of flag
types which all look identical.

Refactor the types so we only have one shared flags type for getters,
and one for setters.

Add compatibility defines so that this doesn’t break API. It’s not an
ABI break because the flag member values don’t change.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:17:45 +00:00
Philip Withnall b2ffb160fc malcontent-client: Print usernames rather than user IDs in output
This makes the output a little easier to interpret.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:17:45 +00:00
Philip Withnall 305129589e malcontent-client: Fix typo in use of flags
This doesn’t actually change the behaviour, since the two types are
equivalent.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:09:23 +00:00
Philip Withnall 983e3bfa39 malcontent-client: Rename ‘check’ command to ‘check-app-filter’
Since it operates only on the app filter. This updates the documentation
too. No compatibility fallback is provided.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:09:23 +00:00
Philip Withnall b3dbc07b92 malcontent-client: Rename ‘set’ command to ‘set-app-filter’
Since it operates only on the app filter. This doesn’t update the
documentation because none has been written for this command yet.
No compatibility fallback is provided.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:09:23 +00:00
Philip Withnall 2b180a9afd malcontent-client: Rename ‘get’ command to ‘get-app-filter’
There’ll be other types of getting happening soon.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:09:16 +00:00
Philip Withnall a7947d56e6 malcontent-client: Fix a minor typo in --help output
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-16 13:09:16 +00:00
Andre Moreira Magalhaes 9f39878c93 malcontent-client: Allow getting/setting filters by content type
Note that this change breaks backward compatibility when handling
content types if the passed argument also resolves to a valid path,
in which case an exception will be raised.

Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>
2019-06-14 15:55:27 +00:00
Andre Moreira Magalhaes 2846db6529 malcontent-client: Refactor logic to determine type of argument for check/set
Note that this change breaks backward compatibility when handling
flatpak refs/IDs if the passed argument also resolves to a valid path,
in which case an exception will be raised.

Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>
2019-06-14 15:55:27 +00:00
Andre Moreira Magalhaes 6c7c386ce2 malcontent-client: Disambiguate usage of path
The cmdline arguments may refer to both paths or flatpak refs so lets
disambiguate here for clarity.

Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>
2019-06-14 15:55:27 +00:00
Philip Withnall 4051a0292a malcontent-client: Implement --quiet for set subcommand
While not entirely quiet on error, the `set` subcommand is now quieter.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-06-11 15:01:08 +01:00
Philip Withnall b14fa7b056 malcontent-client: Implement --quiet for check subcommand
When run with `--quiet`, the `check` subcommand will now print nothing.
It continues to exit with an appropriate exit status.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-06-11 15:00:26 +01:00
Philip Withnall f49e0ecfc0 malcontent-client: Add a ‘monitor’ mode to monitor app filter changes
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-24 13:45:59 +01: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 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 eos-parental-controls-client/eos-parental-controls-client.py (Browse further)