3
Ìœ™^F  ã               @   sV   d Z ddlmZ ddlmZ G dd„ dejƒZG dd„ dejƒZG dd	„ d	ejƒZ	d
S )z
permissions for all the apps
é    )Úugettext)Úpermissionsc               @   s    e Zd ZdZedƒZdd„ ZdS )ÚPrivateTokenAccessPermissionzI
    Custom permission to only allow owners of an object to edit it.
    z0You dont have permission to perform this action!c             C   s"   | j }|jjrdS |jjrdS dS )zL
        Return `True` if permission is granted, `False` otherwise.
        FT)Ú	__class__ÚuserÚis_anonymousÚis_app_user)ÚselfÚrequestÚviewÚ_© r   úI/home/hotel/hotelbackend/hotelapplication/hotelmanage/core/permissions.pyÚhas_permission   s    z+PrivateTokenAccessPermission.has_permissionN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úmessager   r   r   r   r   r      s   r   c               @   s    e Zd ZdZedƒZdd„ ZdS )ÚPublicTokenAccessPermissionzI
    Custom permission to only allow owners of an object to edit it.
    z0You dont have permission to perform this action.c             C   s   | j }|jjrdS |jjS )zL
        Return `True` if permission is granted, `False` otherwise.
        F)r   r   r   r   )r	   r
   r   r   r   r   r   r   "   s    z*PublicTokenAccessPermission.has_permissionN)r   r   r   r   r   r   r   r   r   r   r   r      s   r   c               @   s    e Zd ZdZedƒZdd„ ZdS )Ú"PublicPrivateTokenAccessPermissionzE
    Custom permission to all the users of an object to edit it.
    z/Public Private Token Access Permission violatedc             C   s   | j }|jjrdS dS )zL
        Return `True` if permission is granted, `False` otherwise.
        FT)r   r   r   )r	   r
   r   r   r   r   r   r   2   s    z1PublicPrivateTokenAccessPermission.has_permissionN)r   r   r   r   r   r   r   r   r   r   r   r   ,   s   r   N)
r   Údjango.utils.translationr   r   Úrest_frameworkr   ZBasePermissionr   r   r   r   r   r   r   Ú<module>   s
   