509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
í«„^t  ã               @   sr   d dl Z d dlZddlmZmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZ G dd	„ d	ejejƒZdS )
é    Né   )ÚmixinsÚquery)ÚCriteriaDescriptorÚCriteriaSetDescriptor)ÚInvalidTypeÚRuleUseError)ÚRBACRuletype)Úmatch_indirect_regexc                   s†   e Zd ZdZeed�ZeddƒZdZ	dZ
dZdZdZedd	ƒZdZed
dƒZdZedd„ ƒZejdd„ ƒZ‡ fdd„Zdd„ Z‡  ZS )ÚRBACRuleQueryaÞ  
    Query the RBAC rules.

    Parameter:
    policy            The policy to query.

    Keyword Parameters/Class attributes:
    ruletype        The list of rule type(s) to match.
    source          The name of the source role/attribute to match.
    source_indirect If true, members of an attribute will be
                    matched rather than the attribute itself.
    source_regex    If true, regular expression matching will
                    be used on the source role/attribute.
                    Obeys the source_indirect option.
    target          The name of the target role/attribute to match.
    target_indirect If true, members of an attribute will be
                    matched rather than the attribute itself.
    target_regex    If true, regular expression matching will
                    be used on the target role/attribute.
                    Obeys target_indirect option.
    tclass          The object class(es) to match.
    tclass_regex    If true, use a regular expression for
                    matching the rule's object class.
    default         The name of the default role to match.
    default_regex   If true, regular expression matching will
                    be used on the default role.
    )Ú
enum_classÚsource_regexÚlookup_roleFTNÚtclass_regexZlookup_classÚdefault_regexc             C   s   | j S )N)Ú_target)Úself© r   ú%/usr/lib64/python3.6/rbacrulequery.pyÚtargetG   s    zRBACRuleQuery.targetc             C   sZ   |sd | _ nJ| jr tj|ƒ| _ n6y| jj|ƒ| _ W n" tk
rT   | jj|ƒ| _ Y nX d S )N)r   Útarget_regexÚreÚcompileÚpolicyZlookup_type_or_attrr   r   )r   Úvaluer   r   r   r   K   s    c                s$   t t| ƒj|f|Ž tjtƒ| _d S )N)Úsuperr   Ú__init__ÚloggingZ	getLoggerÚ__name__Úlog)r   r   Úkwargs)Ú	__class__r   r   r   W   s    zRBACRuleQuery.__init__c             c   s>  | j jdj| ƒƒ | j jdj| ƒƒ | j jdj| ƒƒ | j jdj| ƒƒ | j| j ƒ | j jdj| ƒƒ xÒ| jjƒ D ]Ä}| jrŠ|j| jkrŠqr| jrªt	|j| j| j
| jƒ rªqr| jrÊt	|j| j| j| jƒ rÊqry| j|ƒsØwrW n tk
rð   wrY nX | j�r0yt	|j| jd| jƒ�swrW n tk
�r.   wrY nX |V  qrW dS )z/Generator which yields all matching RBAC rules.z,Generating RBAC rule results from {0.policy}zRuletypes: {0.ruletype}zLSource: {0.source!r}, indirect: {0.source_indirect}, regex: {0.source_regex}zLTarget: {0.target!r}, indirect: {0.target_indirect}, regex: {0.target_regex}z0Default: {0.default!r}, regex: {0.default_regex}TN)r   ÚinfoÚformatÚdebugZ_match_object_class_debugr   Z	rbacrulesÚruletypeÚsourcer
   Úsource_indirectr   r   Útarget_indirectr   Z_match_object_classr   Údefaultr   )r   Zruler   r   r   Úresults[   sP    





zRBACRuleQuery.results)r   Ú
__module__Ú__qualname__Ú__doc__r   r	   r%   r   r&   r   r'   r   r   r(   Ztclassr   r)   r   Úpropertyr   Úsetterr   r*   Ú__classcell__r   r   )r!   r   r      s    



r   )r   r   Ú r   r   Zdescriptorsr   r   Z	exceptionr   r   Z	policyrepr	   Úutilr
   ZMatchObjClassZPolicyQueryr   r   r   r   r   Ú<module>   s   