
    ޏRh                     `    S SK Jr  S SKJr  S SKJr  SSKJr   " S S\5      r " S S	\5      r	g
)    )TokenAuthentication)BasePermission)NotAuthenticated   )Adminc                       \ rS rSrSrSrg)BearerAuthentication   Bearer N)__name__
__module____qualname____firstlineno__keyword__static_attributes__r       SC:\Users\ninos\OneDrive\Desktop\project\chat-python-script\master\authentication.pyr	   r	      s    Gr   r	   c                       \ rS rSrSrS rSrg)IsActiveAdmin   zB
Allows access only to authenticated admins whose status is True.
c                 "   UR                   nUR                  (       d  [        S5      e [        R                  R                  UR                  S9nUR                  (       d  [        S5      eg! [        R                   a    [        S5      ef = f)Nz-Authentication credentials were not provided.)namez"Your account has been deactivated.TzAdmin user not found.)	useris_authenticatedr   r   objectsgetusernamestatusDoesNotExist)selfrequestviewr   admins        r   has_permissionIsActiveAdmin.has_permission   sw    ||$$"#RSS	<MM%%4==%9E<<&'KLL!! 	<"#:;;	<s   AA. . Br   N)r   r   r   r   __doc__r%   r   r   r   r   r   r      s    <r   r   N)
rest_framework.authenticationr   rest_framework.permissionsr   rest_framework.exceptionsr   modelsr   r	   r   r   r   r   <module>r,      s*    = 5 6 . <N <r   