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>
This commit is contained in:
Philip Withnall 2020-01-16 11:29:05 +00:00
parent 2b180a9afd
commit b3dbc07b92
1 changed files with 41 additions and 37 deletions

View File

@ -279,9 +279,10 @@ def command_oars_section(user, section, quiet=False, interactive=True):
section, user_id, __oars_value_to_string(value))) section, user_id, __oars_value_to_string(value)))
def command_set(user, allow_user_installation=True, def command_set_app_filter(user, allow_user_installation=True,
allow_system_installation=False, app_filter_args=None, allow_system_installation=False,
quiet=False, interactive=True): app_filter_args=None, quiet=False,
interactive=True):
"""Set the app filter for the given user.""" """Set the app filter for the given user."""
user_id = __lookup_user_id_or_error(user) user_id = __lookup_user_id_or_error(user)
builder = Malcontent.AppFilterBuilder.new() builder = Malcontent.AppFilterBuilder.new()
@ -399,40 +400,43 @@ def main():
'user)') 'user)')
parser_oars_section.add_argument('section', help='OARS section to get') parser_oars_section.add_argument('section', help='OARS section to get')
# set command # set-app-filter command
parser_set = subparsers.add_parser('set', parents=[common_parser], parser_set_app_filter = \
help='set current parental controls ' subparsers.add_parser('set-app-filter', parents=[common_parser],
'settings') help='set current app filter settings')
parser_set.set_defaults(function=command_set) parser_set_app_filter.set_defaults(function=command_set_app_filter)
parser_set.add_argument('user', default='', nargs='?', parser_set_app_filter.add_argument('user', default='', nargs='?',
help='user ID or username to set the app filter ' help='user ID or username to set the '
'for (default: current user)') 'app filter for (default: current '
parser_set.add_argument('--allow-user-installation', 'user)')
dest='allow_user_installation', parser_set_app_filter.add_argument('--allow-user-installation',
action='store_true', dest='allow_user_installation',
help='allow installation to the user flatpak ' action='store_true',
'repo in general') help='allow installation to the user '
parser_set.add_argument('--disallow-user-installation', 'flatpak repo in general')
dest='allow_user_installation', parser_set_app_filter.add_argument('--disallow-user-installation',
action='store_false', dest='allow_user_installation',
help='unconditionally disallow installation to ' action='store_false',
'the user flatpak repo') help='unconditionally disallow '
parser_set.add_argument('--allow-system-installation', 'installation to the user flatpak '
dest='allow_system_installation', 'repo')
action='store_true', parser_set_app_filter.add_argument('--allow-system-installation',
help='allow installation to the system flatpak ' dest='allow_system_installation',
'repo in general') action='store_true',
parser_set.add_argument('--disallow-system-installation', help='allow installation to the system '
dest='allow_system_installation', 'flatpak repo in general')
action='store_false', parser_set_app_filter.add_argument('--disallow-system-installation',
help='unconditionally disallow installation to ' dest='allow_system_installation',
'the system flatpak repo') action='store_false',
parser_set.add_argument('app_filter_args', nargs='*', help='unconditionally disallow '
help='paths, content types or flatpak refs to ' 'installation to the system '
'blacklist and OARS section=value ' 'flatpak repo')
'pairs to store') parser_set_app_filter.add_argument('app_filter_args', nargs='*',
parser_set.set_defaults(allow_user_installation=True, help='paths, content types or flatpak '
allow_system_installation=False) 'refs to blacklist and OARS '
'section=value pairs to store')
parser_set_app_filter.set_defaults(allow_user_installation=True,
allow_system_installation=False)
# Parse the command line arguments and run the subcommand. # Parse the command line arguments and run the subcommand.
args = parser.parse_args() args = parser.parse_args()