Following on from commit b5b1ac2, change a couple of other strings to be
the same to reduce the number of translatable strings. These strings are
unlikely to ever be seen by the user, so it’s not an issue that they’re
becoming a little less specific.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Philip Withnall pointed out that if mct_manager_get_session_limits()
fails with G_DBUS_ERROR_ACCESS_DENIED or
org.freedesktop.Accounts.Error.PermissionDenied, the error message
will wrongly refer to app filter data. Make it more generally applicable.
Signed-off-by: Simon McVittie <smcv@debian.org>
In distributions that package shared libraries and daemons separately,
it's possible to have the shared library (because it's required to run
something like Flatpak) but not the accountsservice daemon or its
malcontent extension (because the administrator of this particular
installation has no interest in parental controls, and their choice of
desktop environment is such that nothing else depends on accountsservice
either). This minimizes the memory and disk space cost of enabling the
libmalcontent feature in Flatpak for those who do not need it, while
keeping it available for those that do.
Treat this the same as if accountsservice is available but the
malcontent extension is not: fail open, by returning
MCT_MANAGER_ERROR_DISABLED.
Resolves: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/27
Bug-Debian: https://bugs.debian.org/972145
Signed-off-by: Simon McVittie <smcv@debian.org>
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>
This is another extension interface on accountsservice which stores
information about time and usage limits on the user session. Currently,
only a ‘daily schedule’ limit (or no limit) is supported, but additional
types and combinations of limits can be supported in future.
The daily schedule limit allows using the computer between a certain
start time and end time each day (the same each day). The user will be
kicked out of their session when the end time is reached, if they
haven’t already logged out.
This includes the getters for the new data, polkit rules for accessing
it, and some documentation. Changes to `malcontent-client` to support
session limits, setters, and unit tests will all follow.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
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>
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>
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