a qéqeÂã@szddlZddlZddlmZddlmZmZddlmZddl m Z ddl m Z ddl mZmZmZGd d „d ee ƒZdS) éN)ÚIterableé)ÚCriteriaDescriptorÚCriteriaSetDescriptor)Ú MatchName)ÚUser)Ú PolicyQuery)Úmatch_regex_or_setÚ match_levelÚ match_rangecsÄeZdZUdZedd�ZdZeed<dZ eed<dZ eed<edd�Z dZ eed <dZ eed <dZeed <dZeed <ed dƒZdZeed<dZeed <ddœ‡fdd„ Zeedœdd„Z‡ZS)Ú UserQueryaf Query SELinux policy users. Parameter: policy The policy to query. Keyword Parameters/Class attributes: name The user name to match. name_regex If true, regular expression matching will be used on the user names. roles The attribute to match. roles_equal If true, only types with role sets that are equal to the criteria will match. Otherwise, any intersection will match. roles_regex If true, regular expression matching will be used on the role names instead of set logic. level The criteria to match the user's default level. level_dom If true, the criteria will match if it dominates the user's default level. level_domby If true, the criteria will match if it is dominated by the user's default level. level_incomp If true, the criteria will match if it is incomparable to the user's default level. range_ The criteria to match the user's range. range_subset If true, the criteria will match if it is a subset of the user's range. range_overlap If true, the criteria will match if it overlaps any of the user's range. range_superset If true, the criteria will match if it is a superset of the user's range. range_proper If true, use proper superset/subset operations. No effect if not using set operations. Z lookup_level)Zlookup_functionFÚ level_domÚ level_dombyÚ level_incompZ lookup_rangeÚ range_overlapÚ range_subsetÚrange_supersetÚ range_properÚ roles_regexZ lookup_roleÚ roles_equalN)Úreturnc s(tt|ƒj|fi|¤Žt t¡|_dS)N)Úsuperr Ú__init__ÚloggingZ getLoggerÚ__name__Úlog)ÚselfÚpolicyÚkwargs©Ú __class__©ú7/usr/lib64/python3.9/site-packages/setools/userquery.pyrCszUserQuery.__init__ccsà|j d |¡¡| |j¡|j d |¡¡|j d |¡¡|j d |¡¡|j ¡D]|}| |¡snq^|jrŒt |j|j|j |j ƒsŒq^|j r®t |j|j |j|j|jƒs®q^|jrÔt|j|j|j|j|j|jƒsÔq^|Vq^dS)z*Generator which yields all matching users.z'Generating user results from {0.policy}z?Roles: {0.roles!r}, regex: {0.roles_regex}, eq: {0.roles_equal}zXLevel: {0.level!r}, dom: {0.level_dom}, domby: {0.level_domby}, incomp: {0.level_incomp}z�Range: {0.range_!r}, subset: {0.range_subset}, overlap: {0.range_overlap}, superset: {0.range_superset}, proper: {0.range_proper}N)rÚinfoÚformatZ_match_name_debugÚdebugrZusersZ _match_nameÚrolesr rrÚlevelr Z mls_levelr rrÚrange_r Z mls_rangerrrr)rÚuserr!r!r"ÚresultsGsN  ÿ ÿ ÿ üûúzUserQuery.results)rÚ __module__Ú __qualname__Ú__doc__rr'r ÚboolÚ__annotations__rrr(rrrrrr&rrrrrr*Ú __classcell__r!r!rr"r s $            r )rÚreÚtypingrZ descriptorsrrZmixinsrZ policyreprÚqueryrÚutilr r r r r!r!r!r"Ús