| Server IP : 85.112.90.236 / Your IP : 192.168.1.26 Web Server : Apache System : Linux 85-112-90-236.cprapid.com 6.12.0-211.7.3.el10_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 12:46:58 EDT 2026 x86_64 User : ftechme ( 1002) PHP Version : 8.2.32 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib64/python3.12/site-packages/setools/ |
Upload File : |
# Copyright 2014-2015, Tresys Technology, LLC
#
# SPDX-License-Identifier: LGPL-2.1-only
#
from collections.abc import Iterable
import typing
from . import mixins, policyrep, query
__all__: typing.Final[tuple[str, ...]] = ("CommonQuery",)
class CommonQuery(mixins.MatchPermission, mixins.MatchName, query.PolicyQuery):
"""
Query common permission sets.
Parameter:
policy The policy to query.
Keyword Parameters/Class attributes:
name The name of the common to match.
name_regex If true, regular expression matching will
be used for matching the name.
perms The permissions to match.
perms_equal If true, only commons with permission sets
that are equal to the criteria will
match. Otherwise, any intersection
will match.
perms_regex If true, regular expression matching will be used
on the permission names instead of set logic.
"""
def results(self) -> Iterable[policyrep.Common]:
"""Generator which yields all matching commons."""
self.log.info(f"Generating common results from {self.policy}")
self._match_name_debug(self.log)
self._match_perms_debug(self.log)
for com in self.policy.commons():
if not self._match_name(com):
continue
if not self._match_perms(com):
continue
yield com