Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions sssd_test_framework/utils/realmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from pytest_mh import MultihostHost, MultihostUtility
from pytest_mh.cli import CLIBuilder, CLIBuilderArgs
from pytest_mh.cli import CLIBuilder
from pytest_mh.conn import ProcessResult

__all__ = [
Expand Down Expand Up @@ -191,37 +191,33 @@ def renew(
command = ["realm", "renew", domain, "--verbose", *args]
return self.host.conn.exec(command)

def permit(self, user: str, *, withdraw: bool = False, args: list[str] | None = None) -> ProcessResult:
def permit(self, *, args: list[str] | None = None) -> ProcessResult:
"""
Permit users log in.
Permit and deny users, groups local log in.
Comment thread
shridhargadekar marked this conversation as resolved.

:param user: User to permit.
:type user: str
:param withdraw: Withdraw permission, defaults to False
:type withdraw: bool, optional
:param args: Additional arguments, defaults to None
:type args: list[str] | None, optional
:return: Result of called command.
:rtype: ProcessResult
"""
cli_args: CLIBuilderArgs = {"withdraw": (self.cli.option.SWITCH, withdraw)}
if args is None:
args = []

return self.host.conn.exec(["realm", "permit", *self.cli.args(cli_args), *args, user])
return self.host.conn.exec(["realm", "permit", *args])

def deny(self, user: str, *, args: list[str] | None = None) -> ProcessResult:
def deny(self, *, args: list[str] | None = None) -> ProcessResult:
"""
Deny users log in.
Deny local log in.

:param user: User.
:type user: str
:param args: Additional arguments, defaults to None
:type args: list[str] | None, optional
:return: Result of called command.
:rtype: ProcessResult
"""
return self.permit(user, withdraw=True, args=args)
if args is None:
args = []

return self.host.conn.exec(["realm", "deny", *args])

def list(self, *, args: list[str] | None = None) -> ProcessResult:
"""
Expand Down
Loading