
    vg                     P    d Z 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 Zd Zy	)
z
accessibility/methods.py
    )cache)ACCESSBILITY_FEATURE)AccessibilityFilter)DefaultAccessibility)_thread_localsc                 B   |syt         j                  j                  |       j                         }|r|j                  ry| r|syt        j                  |i       }|r"|j                  |       |j                  |       S |j                  j                         }||v }|S )zK
    Method to check the employee is accessible for the feature or not
    F)featureT)default)	r   objectsfilterfirstexclude_allr   get	employeesall)r	   	cache_keyemployeeaccessibilitydatar   
accessibles          )/var/www/horilla/accessibility/methods.pycheck_is_accessibler      s     (00777HNNPM22-9b1D!-xx  ''++-IY&J    c                 p    i }t         D ]  \  }}t        || |      ||<    t        j                  | |       y)z(
    Cache for get all the queryset
    N)r   r   r   set)r   r   feature_accessibler   _displays        r   #update_employee_accessibility_cacher   $   sF     #7 
x,?9h-
=)
 
IIi+,r   N)__doc__django.core.cacher   accessibility.accessibilityr   accessibility.filtersr   accessibility.modelsr   horilla.horilla_middlewaresr   r   r    r   r   <module>r&      s%    $ < 5 5 6.	-r   