
    xhX                     <    S SK Jr  S SKJr  SSKJr  S\\   4S jrg)    )wraps)	HttpError   )AuthHttpRequestpermissionsc                    ^  U 4S jnU$ )z
Check scoped permissions. At this time only token authentication is checked.

Example: @has_permission(["event:write", "event:admin"])

The decorated function requires at least one of the specified permissions.
c                 D   >^  [        T 5      S[        4U U4S jj5       nU$ )Nrequestc                    >#    U R                   R                  S:X  aJ  U R                   R                  R                  5       n[	        U4S jU 5       5      (       d  [        SS5      eT" U /UQ70 UD6I S h  vN $  N7f)Ntokenc              3   ,   >#    U  H	  oT;   v   M     g 7f)N ).0sr   s     "/code/glitchtip/api/permissions.py	<genexpr>Phas_permission.<locals>.decorator.<locals>.decorated_function.<locals>.<genexpr>   s     <V+Vs   i  zPermission denied)auth	auth_typedata
get_scopesanyr   )r
   argskwargsscopesfr   s       r   decorated_function=has_permission.<locals>.decorator.<locals>.decorated_function   sj     ||%%0 **557<V<<<#C)<==74T4V4444s   A4A>7A<8A>)r   r   )r   r   r   s   ` r   	decorator!has_permission.<locals>.decorator   s(    	q	5o 	5 
	5 "!    r   )r   r   s   ` r   has_permissionr"      s    	" r!   N)		functoolsr   ninja.errorsr   authenticationr   liststrr"   r   r!   r   <module>r(      s     " +S	 r!   