
    si6                     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                 D   |syt         j                  j                  | d      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
    FT)feature
is_enabled)default)	r   objectsfilterfirstexclude_allr   get	employeesall)r	   	cache_keyemployeeaccessibilitydatar   
accessibles          9/var/www/python-projects/worksol/accessibility/methods.pycheck_is_accessibler      s     (0077D 8 eg  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2	-r   