https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/trac/versioncontrol/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/trac/versioncontrol/__pycache__/svn_authz.cpython-310.pyc
o

�k�`�$�@s�ddlZddlmZmZmZmZmZddlm	Z	m
Z
mZddlm
Z
ddlmZmZddlmZddlmZdd	�Zd
d�ZGdd
�d
e	�ZdS)�N)�ConfigurationError�Option�ParsingError�
PathOption�UnicodeConfigParser)�	Component�	TracError�
implements)�IPermissionPolicy)�pathjoin�to_list)�exception_to_unicode)�RepositoryManagerccsD�	|V|dkrdS|dd�}|V|�d�}|d|d�}q)N��/���)�rfind)�path�idx�r�?/usr/lib/python3/dist-packages/trac/versioncontrol/svn_authz.py�parent_iters�
�rc
sltdd�}|�|�i�i�i}|��D]d��dkr1|���D]\}}��|t���t|��qq�dkrF|���D]
\}}|���|<q:q|���D],\}}��	dd�}t
|�dkr_|dnd|d	}}||vrw|�||fg��||f�qKq���fd
d��i}	|��D],\\}}}
|	�|i��|i��|
D]\}}d|v�����fd
d��|t��D��q�q�|	S)z�Parse a Subversion authorization file.

    Return a dict of modules, each containing a dict of paths, each containing
    a dict mapping users to permissions. Only modules contained in `modules`
    are retained.
    F)�ignorecase_option�groups�aliases�:rr�rc3st�|�d�r%|�|��|dd�|D]
}�||�D]}|VqqdS|�d�r5�|dd�VdS|VdS)N�@r�&)�
startswith�add)�subject�done�members�each)rr�resolverrr%Es�

��

zparse.<locals>.resolve�rc3s"�|]}��|�s|�fVqdS�N��get)�.0�user)�readable�sectionrr�	<genexpr>Vs
��zparse.<locals>.<genexpr>)r�read�sections�items�
setdefault�set�updater�strip�split�len�append)
�
authz_file�modules�parserr0�name�value�parts�moduler�authzr1r!�permsr)rrr,r%r-r�parse)sB

��"��

��rBc@s`eZdZdZee�eddddddid�Zedd	dd
�Z	e
gd��Zdd
�Zdd�Z
dd�ZdS)�AuthzSourcePolicya^Permission policy for `source:` and `changeset:` resources using a
    Subversion authz file.

    `FILE_VIEW` and `BROWSER_VIEW` permissions are granted as specified in the
    authz file.

    `CHANGESET_VIEW` permission is granted for changesets where `FILE_VIEW` is
    granted on at least one modified file, as well as for empty changesets.
    �svnr9ra8The path to the Subversion
        [%(svnbook)s authorization (authz) file].
        To enable authz permission checking, the `AuthzSourcePolicy`
        permission policy must be added to `[trac] permission_policies`.
        Non-absolute paths are relative to the Environment `conf`
        directory.
        �svnbookzGhttp://svnbook.red-bean.com/en/1.7/svn.serverconfig.pathbasedauthz.html)�doc_args�authz_module_namez�The module prefix used in the `authz_file` for the default
        repository. If left empty, the global section is used.
        ))N�BROWSER_VIEW)N�CHANGESET_VIEW)N�	FILE_VIEW)N�LOG_VIEW)�sourcerH)rLrJ)rLrK)�	changesetrIcCsd|_i|_t�|_dS)Nr)�_mtime�_authzr3�_users)�selfrrr�__init__�szAuthzSourcePolicy.__init__c	sB|r|jnd}||f|jvr�|��\�}�durdS|dkr!d�n|ddf�|dur4|t��@r2dSdSt|j�}z	|�|jj��Wn
t	yLYdSw�durSdS|jjpY|j
g��drd��d����fd	d
������fdd��|d
kr~�|j�S|dkr�t��
|j����}|r�t�fdd�|D��r�dSdSdSdS)NF�	anonymous)z
$anonymous�*z$authenticatedrTTrrcsf��fdd��D�}dd�|D�}d}�D]}|D]}||vr+||r'dSd}nqq|r1dSdS)Ncsg|]}��|i�����qSrr(�r*r?)r@�spathrr�
<listcomp>�s�zLAuthzSourcePolicy.check_permission.<locals>.check_path_0.<locals>.<listcomp>cSsg|]}|r|�qSrr)r*r-rrrrW�sFTr)rVr0�deniedr+r-)r@r:�	usernames)rVr�check_path_0�s"����z8AuthzSourcePolicy.check_permission.<locals>.check_path_0cs�dt�j|�}|dkr|d7}tt�fdd��D�g��D]}|�|�r0�|�}|dur0dSqt|�D]}�|�}|durC|Sq5dS)Nrc3s �|]}t��|i��VqdSr')�listr)rU)r@rrr.�s��zIAuthzSourcePolicy.check_permission.<locals>.check_path.<locals>.<genexpr>T)r�scoper3�sumrr)rrV�result)r@rZr:�reposrr�
check_path�s&�
�
���z6AuthzSourcePolicy.check_permission.<locals>.check_pathrLrMc3s�|]	}�|d�VqdS)rNr)r*�change)r`rrr.�s��z5AuthzSourcePolicy.check_permission.<locals>.<genexpr>)�realm�_handled_perms�_get_authz_infor3r�env�get_repository�parent�idrrGr8r[�
get_changeset�get_changes�any)	rQ�action�username�resource�permrb�users�rm�changesr)r@r`rZr:r_rYr�check_permission�sD

�

��?z"AuthzSourcePolicy.check_permissionc
Cs&|js|j�d�t��z	tj�|j�}Wnty-}z|j�dt|��t��d}~ww||j	kr�||_	t
|j�}tdd�|�
�D��}d|vrS|jrS|�|j�|�d�|j�d|j�z	t|j|�|_Wnty�}z|j�dt|��t��d}~wwdd	�|j��D�|_|j|jfS)
NzMThe [svn] authz_file configuration option in trac.ini is empty or not definedz4Error accessing svn authz permission policy file: %scss�|]}|jVqdSr')�reponame)r*r_rrrr.�s��z4AuthzSourcePolicy._get_authz_info.<locals>.<genexpr>rzParsing authz file: %sz2Error parsing svn authz permission policy file: %scSs4h|]}|��D]}|��D]\}}|r|�qqqSr)�valuesr1)r*�pathsrr+r^rrr�	<setcomp>�s���z4AuthzSourcePolicy._get_authz_info.<locals>.<setcomp>)r9�log�errorr�osr�getmtime�OSErrorr
rNrrer3�get_real_repositoriesrGr �inforBrOrrurP)rQ�mtime�erqr:rrrrd�sF���

�
����z!AuthzSourcePolicy._get_authz_infoN)�__name__�
__module__�__qualname__�__doc__r	r
rr9rrG�	frozensetrcrRrsrdrrrrrC\s
��	GrC)�os.pathrz�trac.configrrrrr�	trac.corerrr	�	trac.permr
�	trac.utilrr�trac.util.textr
�trac.versioncontrol.apirrrBrCrrrr�<module>s3

https://t.me/RX1948 - 2025