Ë
    tPêj  ã                   óŽ   — d dl mZ d dlmZmZ dedz  defd„Zdedz  dee   fd„Z	dedz  dedz  fd„Z
d	edz  dedz  defd
„Zy)é    )ÚFinal)ÚLitellmUserRolesÚUserAPIKeyAuthÚuser_api_key_dictNÚreturnc                 ó”   — | €y| j                   t        j                  k(  xs' | j                   t        j                  j                  k(  S )NF)Ú	user_roler   ÚPROXY_ADMINÚvalue©r   s    úr/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/proxy/common_utils/resource_ownership.pyÚis_proxy_adminr      sH   € ØÐ Øð 	×#Ñ#Ô'7×'CÑ'CÑCò 	MØ×&Ñ&Ô*:×*FÑ*F×*LÑ*LÑLðó    c                 ó¤  ‡— | €g S g Šdt         dz  ddfˆfd„}| j                  r' || j                  «        |d| j                  › �«       | j                  r |d| j                  › �«       | j                  r |d| j                  › �«       | j                  r |d| j                  › �«       | j
                  r |d| j
                  › �«       ‰S )	u�  
    Return ownership scopes that may access a user-created proxy resource.

    Raw user_id is included for rows created before scope prefixes existed.
    Prefixes avoid collisions when falling back to team/org/key ownership
    for keys that do not have a user_id.

    Identity-less callers (no user_id, team_id, org_id, api_key, or token)
    return ``[]`` â€” they share no scope with any other caller, so access
    checks against an existing owner always fail and creates that depend
    on a primary scope must reject up front. Returning a shared sentinel
    here would let any two identity-less callers see each other's data.
    NÚscoper   c                 ó8   •— | r| ‰vr‰j                  | «       y y y )N)Úappend)r   Úscopess    €r   Ú_addz'get_resource_owner_scopes.<locals>._add%   s    ø€ Ù�U &Ñ(Ø�M‰M˜%Õ ð )ˆ5r   zuser:úteam:úorg:úkey:)ÚstrÚuser_idÚteam_idÚorg_idÚapi_keyÚtoken)r   r   r   s     @r   Úget_resource_owner_scopesr      sâ   ø€ ð  Ð Øˆ	à!€Fð!”C˜$‘Jð ! 4õ !ð × Ò ÙÐ×&Ñ&Ô'ÙˆuÐ&×.Ñ.Ð/Ð0Ô1Ø× Ò ÙˆuÐ&×.Ñ.Ð/Ð0Ô1Ø×ÒÙˆtÐ%×,Ñ,Ð-Ð.Ô/Ø× Ò ÙˆtÐ%×-Ñ-Ð.Ð/Ô0Ø×ÒÙˆtÐ%×+Ñ+Ð,Ð-Ô.à€Mr   c                 ó  — | €y| j                   r| j                   S | j                  rd| j                  › �S | j                  rd| j                  › �S | j                  rd| j                  › �S | j                  rd| j                  › �S y)uT  Return the canonical owner scope to stamp on newly-created rows.

    ``None`` for identity-less callers â€” callers that depend on a primary
    scope to record ownership must surface that as a hard error rather
    than fall back to a shared sentinel (which would collapse every
    identity-less caller into the same logical owner).
    Nr   r   r   )r   r   r   r   r   r   s    r   Ú get_primary_resource_owner_scoper!   8   s�   € ð Ð Øà× Ò Ø ×(Ñ(Ð(Ø× Ò ØÐ(×0Ñ0Ð1Ð2Ð2Ø×ÒØÐ'×.Ñ.Ð/Ð0Ð0Ø× Ò ØÐ'×/Ñ/Ð0Ð1Ð1Ø×ÒØÐ'×-Ñ-Ð.Ð/Ð/Ør   Úownerc                 ó@   — |€yt        |«      ry| €y| t        |«      v S )NTF)r   r   )r"   r   s     r   Úuser_can_access_resource_ownerr$   R   s3   € ð Ð ØÜÐ'Ô(ØØ€}ØØÔ-Ð.?Ó@Ð@Ð@r   )Útypingr   Úlitellm.proxy._typesr   r   Úboolr   Úlistr   r   r!   r$   © r   r   ú<module>r*      sŒ   ðÝ ç Að n°tÑ&;ð Àó ð%Ø%¨Ñ,ð%à	ˆ#�Yó%ðPØ%¨Ñ,ðàˆ4�Zóð4
AØ�‰:ð
Aà%¨Ñ,ð
Að 
ô
Ar   