From 9a890750c4b431d7da761980d4ac8562dc2d0885 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 13 Nov 2018 11:46:24 +0000 Subject: [PATCH] =?UTF-8?q?eos-parental-controls-client:=20Print=20app=20f?= =?UTF-8?q?ilter=20on=20=E2=80=98get=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we just printed whether the filter was successfully retrieved, since there weren’t any non-parameterised getter functions on EpcAppFilter. Now we have some of them, we can print details of the app filter. Signed-off-by: Philip Withnall https://phabricator.endlessm.com/T24457 --- .../eos-parental-controls-client.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/eos-parental-controls-client/eos-parental-controls-client.py b/eos-parental-controls-client/eos-parental-controls-client.py index f803dc5..24c4b73 100644 --- a/eos-parental-controls-client/eos-parental-controls-client.py +++ b/eos-parental-controls-client/eos-parental-controls-client.py @@ -127,9 +127,21 @@ def __oars_value_from_string(value_str): def command_get(user, quiet=False, interactive=True): """Get the app filter for the given user.""" user_id = __lookup_user_id_or_error(user) - __get_app_filter_or_error(user_id, interactive) + app_filter = __get_app_filter_or_error(user_id, interactive) - print('App filter for user {} retrieved'.format(user_id)) + print('App filter for user {} retrieved:'.format(user_id)) + + sections = app_filter.get_oars_sections() + for section in sections: + value = app_filter.get_oars_value(section) + print(' {}: {}'.format(section, oars_value_mapping[value])) + if not sections: + print(' (No OARS values)') + + if app_filter.is_app_installation_allowed(): + print('App installation is allowed') + else: + print('App installation is disallowed') def command_check(user, path, quiet=False, interactive=True):