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>
This commit is contained in:
parent
c627fbc9b8
commit
3f3bb6ee54
4 changed files with 120 additions and 66 deletions
|
@ -37,9 +37,14 @@ def __get_app_filter(user_id, interactive):
|
|||
|
||||
If `interactive` is `True`, interactive polkit authorisation dialogues will
|
||||
be allowed. An exception will be raised on failure."""
|
||||
if interactive:
|
||||
flags = Malcontent.GetAppFilterFlags.INTERACTIVE
|
||||
else:
|
||||
flags = Malcontent.GetAppFilterFlags.NONE
|
||||
|
||||
return Malcontent.get_app_filter(
|
||||
connection=None, user_id=user_id,
|
||||
allow_interactive_authorization=interactive, cancellable=None)
|
||||
flags=flags, cancellable=None)
|
||||
|
||||
|
||||
def __get_app_filter_or_error(user_id, interactive):
|
||||
|
@ -58,9 +63,14 @@ def __set_app_filter(user_id, app_filter, interactive):
|
|||
|
||||
If `interactive` is `True`, interactive polkit authorisation dialogues will
|
||||
be allowed. An exception will be raised on failure."""
|
||||
if interactive:
|
||||
flags = Malcontent.GetAppFilterFlags.INTERACTIVE
|
||||
else:
|
||||
flags = Malcontent.GetAppFilterFlags.NONE
|
||||
|
||||
Malcontent.set_app_filter(
|
||||
connection=None, user_id=user_id, app_filter=app_filter,
|
||||
allow_interactive_authorization=interactive, cancellable=None)
|
||||
flags=flags, cancellable=None)
|
||||
|
||||
|
||||
def __set_app_filter_or_error(user_id, app_filter, interactive):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue