OwlCyberSecurity - MANAGER
Edit File: checks.cpython-39.pyc
a iH�f� � @ s` d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z ddl mZ d d d �Zddd�Z dS )� )�chain)� MethodType)�apps)�settings)�checks� )�_get_builtin_permissionsNc s� | d u rt �tj�� n6tj�d�\}}| D ]}|j|kr*|�|�� qLq*g S g }t� jtt f�sv|� tjd� dd�� � j � jv r�|� tjdd� j � j f � dd�� � j�� j �j�s.t� fd d �� jjD ���s.tjdgk�r|� tjd� jj� j f � d d�� n&|� tjd� jj� j f d� dd�� t� � jt��rX|� tjd� � dd�� t� � jt��r�|� tjd� � dd�� |S )N�.z*'REQUIRED_FIELDS' must be a list or tuple.z auth.E001��obj�idzjThe field named as the 'USERNAME_FIELD' for a custom user model must not be included in 'REQUIRED_FIELDS'.zaThe 'USERNAME_FIELD' is currently set to '%s', you should remove '%s' from the 'REQUIRED_FIELDS'.z auth.E002)�hintr r c 3 s | ]}|j � jfkV qd S �N)�fields�USERNAME_FIELD)�.0� constraint��cls� �\/home/gouroczh/virtualenv/test/3.9/lib/python3.9/site-packages/django/contrib/auth/checks.py� <genexpr>7 s �z#check_user_model.<locals>.<genexpr>z)django.contrib.auth.backends.ModelBackendzC'%s.%s' must be unique because it is named as the 'USERNAME_FIELD'.z auth.E003z?'%s.%s' is named as the 'USERNAME_FIELD', but it is not unique.zKEnsure that your authentication backend(s) can handle non-unique usernames.z auth.W004z�%s.is_anonymous must be an attribute or property rather than a method. Ignoring this is a security issue as anonymous users will be treated as authenticated!z auth.C009z�%s.is_authenticated must be an attribute or property rather than a method. Ignoring this is a security issue as anonymous users will be treated as authenticated!z auth.C010)r � get_modelr ZAUTH_USER_MODEL�split�label� isinstanceZREQUIRED_FIELDS�list�tuple�appendr �Errorr �_meta� get_field�unique�anyZtotal_unique_constraintsZAUTHENTICATION_BACKENDSZobject_name�WarningZis_anonymousr ZCritical�is_authenticated)�app_configs�kwargsZ app_label� model_name� app_config�errorsr r r �check_user_model s� �� ���� ���� ��� ��� ��� r+ c K s | d u rt �� }nt�dd� | D ��}t �dd�}|j�d�j}|j�d�j}g }|D �]�}|j}tt |��} | r�t dd� | �� D ��nd} | |kr�|| t|j � }|�tjd |j||f |d d�� | r�t dd� | �� D ��nd}||k�r$||t|j� } |�tjd |j| |f |dd�� t� }|jD ]�\}}t|�|k�rh|�tjd||j|f |dd�� t|�|k�r�|�tjd||j|f |dd�� || v �r�|�tjd||jf |dd�� n*||v �r�|�tjd||jf |dd�� |�|� �q0qV|S )Nc s s | ]}|� � V qd S r )� get_models)r r) r r r r o s z+check_models_permissions.<locals>.<genexpr>�auth� Permission�name�codenamec s s | ]}t |�V qd S r ��len)r r/ r r r r } � r zzThe verbose_name of model '%s' must be at most %d characters for its builtin permission names to be at most %d characters.z auth.E007r c s s | ]}t |�V qd S r r1 )r r0 r r r r � r3 zvThe name of model '%s' must be at most %d characters for its builtin permission codenames to be at most %d characters.z auth.E011zEThe permission named '%s' of model '%s' is longer than %d characters.z auth.E008zIThe permission codenamed '%s' of model '%s' is longer than %d characters.z auth.E012zOThe permission codenamed '%s' clashes with a builtin permission for model '%s'.z auth.E005z;The permission codenamed '%s' is duplicated for model '%s'.z auth.E006)r r, r � from_iterabler r r! � max_length�dictr �max�valuesr2 Zverbose_name_rawr r r r �keysr( �setZpermissions�add)r&