Skip to content

Commit

Permalink
roles: adding gpo management to samba role
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Lavu committed Jun 21, 2024
1 parent 153acbc commit 1c200c0
Show file tree
Hide file tree
Showing 3 changed files with 388 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sssd_test_framework/roles/ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,10 +1753,10 @@ def link(
args: list[str] | str | None = None,
) -> GPO:
"""
Link the group policy to the a target object inside the directory, a site, domain or an ou.
Link the group policy to the target object inside the directory, a site, domain or an ou.
..Note::
The New and Set cmdlets are identical. To modify an an existing link,
The New and Set cmdlets are identical. To modify an existing link,
change the $op parameter to "Set", i.e. to disable 'Enforced'
ou_policy.link("Set", args=["-Enforced No"])
Expand Down
72 changes: 72 additions & 0 deletions sssd_test_framework/roles/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"GenericAutomount",
"GenericAutomountMap",
"GenericAutomountKey",
"GenericGPO",
]


Expand Down Expand Up @@ -288,6 +289,14 @@ def fqn(self, name: str) -> str:
def firewall(self) -> Firewall:
pass

@property
@abstractmethod
def gpo(self) -> GenericGPO:
"""
Generic GPO management.
"""
pass


class GenericUser(ABC, BaseObject):
"""
Expand Down Expand Up @@ -961,3 +970,66 @@ def dump(self) -> str:
@abstractmethod
def __str__(self) -> str:
pass


class GenericGPO(ABC, object):
"""
Generic GPO management.
"""

@abstractmethod
def get(self, key: str) -> str | None:
"""
Get GPO attribute.
:param key: GPO key value.
:type key: str
:return: GPO key value.
:rtype: str | None
"""
pass

@abstractmethod
def delete(self) -> None:
"""
Delete GPO.
"""
pass

@abstractmethod
def add(self) -> GenericGPO:
"""
Add GPO.
"""
pass

@abstractmethod
def link(self,
op: str | None = "New",
target: str | None = None,
args: list[str] | str | None = None) -> GenericGPO:
"""
Link GPO.
"""
pass

@abstractmethod
def unlink(self) -> None:
"""
Unlink GPO.
"""
pass

@abstractmethod
def permissions(self, target: str, permission_level: str, target_type: str | None = "Group") -> GenericGPO:
"""
Configure GPO permissions.
"""
pass

@abstractmethod
def policy(self, logon_rights: dict[str, list[GenericUser]], cfg: dict[str, Any] | None = None) -> GenericGPO:
"""
GPO configuration.
"""
pass
Loading

0 comments on commit 1c200c0

Please sign in to comment.