U
    {h                     @   sp   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 da
G dd dZd	d
 Zeedd Ze  dS )    )receiver)setting_changed)get_image_model)Image)#CollectionOwnershipPermissionPolicyNc                   @   s   e Zd ZdZdddZdS )ImagesPermissionPolicyGettera  
    A helper to retrieve the current permission policy dynamically.
    Following the descriptor protocol, this should be used as a class attribute::

        class MyImageView(PermissionCheckedMixin, ...):
            permission_policy = ImagesPermissionPolicyGetter()
    Nc                 C   s   t S )N)permission_policy)selfobjobjtype r   b/var/www/dating/data/www/fatepal.com/env/lib/python3.8/site-packages/wagtail/images/permissions.py__get__   s    z$ImagesPermissionPolicyGetter.__get__)N)__name__
__module____qualname____doc__r   r   r   r   r   r      s   r   c                   C   s   t t tddadS )z7Sets the permission policy for the current image model.Zuploaded_by_user)Z
auth_modelZowner_field_nameN)r   r   r   r   r   r   r   r   set_permission_policy   s
      r   c                 K   s   |dkrt   dS )z
    Updates the permission policy when the `WAGTAILIMAGES_IMAGE_MODEL` setting changes.
    This is useful in tests where we override the base image model and expect the
    permission policy to have changed accordingly.
    ZWAGTAILIMAGES_IMAGE_MODELN)r   )signalZsenderZsettingkwargsr   r   r   update_permission_policy!   s    r   )Zdjango.dispatchr   Zdjango.test.signalsr   Zwagtail.imagesr   Zwagtail.images.modelsr   Z'wagtail.permission_policies.collectionsr   r   r   r   r   r   r   r   r   <module>   s   	
