
    p:i
                     B    d dl T d dlmZ d dlmZ  G d de          ZdS )    )*)ConfigSection)IPermissionRequestorc                   H    e Zd ZdZ ee            edd          Zd ZdS )ExtraPermissionsProviderzDefine arbitrary permissions.

    Documentation can be found on the [wiki:TracIni#extra-permissions-section]
    page after enabling the component.zextra-permissionsa|  This section provides a way to add arbitrary permissions to a
        Trac environment. This can be useful for adding new permissions to use
        for workflow actions, for example.

        To add new permissions, create a new section `[extra-permissions]` in
        your `trac.ini`. Every entry in that section defines a meta-permission
        and a comma-separated list of permissions. For example:
        {{{#!ini
        [extra-permissions]
        EXTRA_ADMIN = EXTRA_VIEW, EXTRA_MODIFY, EXTRA_DELETE
        }}}
        This entry will define three new permissions `EXTRA_VIEW`,
        `EXTRA_MODIFY` and `EXTRA_DELETE`, as well as a meta-permissions
        `EXTRA_ADMIN` that grants all three permissions.

        The permissions are created in upper-case characters regardless of
        the casing of the definitions in `trac.ini`. For example, the
        definition `extra_view` would create the permission `EXTRA_VIEW`.

        If you don't want a meta-permission, start the meta-name with an
        underscore (`_`):
        {{{#!ini
        [extra-permissions]
        _perms = EXTRA_VIEW, EXTRA_MODIFY
        }}}
        )docc                    i }| j                                         D ]\  }}d |                    d          D             }|D ]}|                    |g            |                                                                }|r>|                    d          s)|                    |g                               |           d |                                D             S )Nc                 Z    g | ](}|                                                                 )S  )stripupper).0eachs     Y/var/www/html/trac/venv/lib/python3.11/site-packages/tracopt/perm/config_perm_provider.py
<listcomp>zCExtraPermissionsProvider.get_permission_actions.<locals>.<listcomp>:   s,    GGGdTZZ\\''))GGG    ,_c                 $    g | ]\  }}|r||fn|S r   r   )r   kvs      r   r   zCExtraPermissionsProvider.get_permission_actions.<locals>.<listcomp>@   s)    CCCtq!!"ACCCr   )	extra_permissions_sectionoptionssplit
setdefaultr   r   
startswithextenditems)selfpermissionsmetapermsperms        r   get_permission_actionsz/ExtraPermissionsProvider.get_permission_actions7   s    9AACC 	? 	?KD%GGekk#6F6FGGGE 1 1&&tR0000::<<%%''D ?DOOC00 ?&&tR0077>>>CC{/@/@/B/BCCCCr   N)	__name__
__module____qualname____doc__
implementsr   r   r   r$   r   r   r   r   r      sd        * *
 J#$$$ -.A! ! !8	D 	D 	D 	D 	Dr   r   N)	trac.coretrac.configr   	trac.permr   	Componentr   r   r   r   <module>r.      su        % % % % % % * * * * * *-D -D -D -D -Dy -D -D -D -D -Dr   