
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
3
^                 @   sv   d dl Z d dlZd dlmZ ddlmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZmZ G d	d
 d
e
eZdS )    N)suppress   )CriteriaDescriptorCriteriaSetDescriptor)NoCommon)	MatchName)PolicyQuery)match_regexmatch_regex_or_setc                   sJ   e Zd ZdZeddZdZedZdZ	dZ
dZ fddZd	d
 Z  ZS )ObjClassQueryaO  
    Query object classes.

    Parameter:
    policy          The policy to query.

    Keyword Parameters/Class attributes:
    name            The name of the object set to match.
    name_regex      If true, regular expression matching will
                    be used for matching the name.
    common          The name of the inherited common to match.
    common_regex    If true, regular expression matching will
                    be used for matching the common 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.
                    comparison will not be used.
    perms_indirect  If false, permissions inherited from a common
                    permission set not will be evaluated.  Default
                    is true.
    common_regexZlookup_commonFperms_regexTc                s$   t t| j|f| tjt| _d S )N)superr   __init__loggingZ	getLogger__name__log)selfpolicykwargs)	__class__ %/usr/lib64/python3.6/objclassquery.pyr   B   s    zObjClassQuery.__init__c             c   s   | j jdj|  | j| j  | j jdj|  | j jdj|  x| jj D ]}| j|s^qN| jryt	|j| j| j
szwNW n tk
r   wNY nX | jr|j}| jrtt ||jjO }W dQ R X t|| j| j| jsqN|V  qNW dS )z3Generator which yields all matching object classes.z/Generating object class results from {0.policy}z-Common: {0.common!r}, regex: {0.common_regex}z[Perms: {0.perms}, regex: {0.perms_regex}, eq: {0.perms_equal}, indirect: {0.perms_indirect}N)r   infoformatZ_match_name_debugdebugr   classesZ_match_namecommonr	   r   r   permsperms_indirectr   r
   perms_equalr   )r   Zclass_r   r   r   r   resultsF   s:    


zObjClassQuery.results)r   
__module____qualname____doc__r   r   r   r   r   r    r   r   r   r!   __classcell__r   r   )r   r   r      s   
r   )r   re
contextlibr   Zdescriptorsr   r   Z	exceptionr   Zmixinsr   Zqueryr   utilr	   r
   r   r   r   r   r   <module>   s   