
    Gwg                      \    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dl
mZ dd	Zdd
Zy)    )chain)
MethodType)apps)settings)checks   )_get_builtin_permissionsNc           
      d   | $t        j                  t        j                        nMt        j                  j	                  d      \  }}| D ]$  }|j
                  |k(  s|j                  |       n g S g }t        j                  t        t        f      s'|j                  t        j                  dd             j                  j                  v rC|j                  t        j                  ddj                  dj                  dd	
             j                  j                  j                        j                   st#        fdj                  j$                  D              st        j&                  dgk(  rM|j                  t        j                  dj                  j(                  dj                  dd             nM|j                  t        j*                  dj                  j(                  dj                  ddd
             t                j,                  t.              r*|j                  t        j0                  dz  d             t                j2                  t.              r*|j                  t        j0                  dz  d             |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'.z*The 'USERNAME_FIELD' is currently set to 'z', you should remove 'z' from the 'REQUIRED_FIELDS'.z	auth.E002)hintr   r   c              3   R   K   | ]  }|j                   j                  fk(     y wN)fieldsUSERNAME_FIELD).0
constraintclss     Q/var/www/horilla/myenv/lib/python3.12/site-packages/django/contrib/auth/checks.py	<genexpr>z#check_user_model.<locals>.<genexpr>7   s/      F 	c0022Fs   $'z)django.contrib.auth.backends.ModelBackend'z=' must be unique because it is named as the 'USERNAME_FIELD'.z	auth.E003z9' 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   AUTH_USER_MODELsplitlabel
isinstanceREQUIRED_FIELDSlisttupleappendr   Errorr   _meta	get_fielduniqueanytotal_unique_constraintsAUTHENTICATION_BACKENDSobject_nameWarningis_anonymousr   Criticalis_authenticated)app_configskwargs	app_label
model_name
app_configerrorsr   s         @r   check_user_modelr5      s`   nnX556 ( 8 8 > >s C	:% 	J9, **:6	 IF c))D%=9LL<	
 S000LLU
 ))3+=+=? 
	
 99s11299# F))<<F C ++70
 
 MM+.99+@+@#BTBTV"	 MMyy,,c.@.@B0 "	 #%$$j1OO:<?@ 	
 #%((*5OO:<?@ 	
 M    c                    | t        j                         }nt        j                  d | D              }t        j                  dd      }|j
                  j                  d      j                  }|j
                  j                  d      j                  }g }|D ]M  }|j
                  }t        t        |            }	|	r t        d |	j                         D              nd}
|
|kD  rR||
t        |j                        z
  z
  }|j                  t        j                   d|j"                  ||fz  |d	
             |	r t        d |	j%                         D              nd}||kD  rR||t        |j&                        z
  z
  }|j                  t        j                   d|j"                  ||fz  |d
             t)               }|j*                  D ]  \  }}t        |      |kD  r7|j                  t        j                   d||j"                  |fz  |d
             t        |      |kD  r7|j                  t        j                   d||j"                  |fz  |d
             ||	v r9|j                  t        j                   d|d|j"                  d|d
             n<||v r8|j                  t        j                   d|d|j"                  d|d
             |j-                  |        P |S )Nc              3   <   K   | ]  }|j                           y wr   )
get_models)r   r3   s     r   r   z+check_models_permissions.<locals>.<genexpr>o   s      %
(2J!!#%
s   auth
Permissionnamecodenamec              3   2   K   | ]  }t        |        y wr   len)r   r<   s     r   r   z+check_models_permissions.<locals>.<genexpr>}   s     CdD	C   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              3   2   K   | ]  }t        |        y wr   r?   )r   r=   s     r   r   z+check_models_permissions.<locals>.<genexpr>   s     I(HIrA   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.E012zThe permission codenamed 'z/' clashes with a builtin permission for model 'z'.z	auth.E005z' is duplicated for model 'z	auth.E006)r   r9   r   from_iterabler   r$   r%   
max_lengthdictr	   maxvaluesr@   verbose_name_rawr"   r   r#   r   keysr2   setpermissionsadd)r/   r0   modelsr;   permission_name_max_lengthpermission_codename_max_lengthr4   modeloptsbuiltin_permissions"max_builtin_permission_name_lengthverbose_name_max_length&max_builtin_permission_codename_lengthmodel_name_max_length	codenamesr=   r<   s                    r   check_models_permissionsrX   k   s
   "$$ %
6A%
 
 5J!+!1!1!;!;F!C!N!N%/%5%5%?%?
%K%V%V"F b${{"#;D#AB # C&9&@&@&BCC 	+
 .0JJ&@2S9N9N5OO'# MM* zz#:<VWX "	 # I.A.F.F.HII 	/
 24RR$B6T__9MM%! MM" 

-6 " E	".. 2	$NHd4y55LL. ! JJ6 "&
 8}==LL5 % JJ: "&
 ..LL8@$**N!&	 Y&LL)14::?!&	 MM(#e2	$ab$H Mr6   r   )	itertoolsr   typesr   django.appsr   django.confr   django.corer   
managementr	   r5   rX    r6   r   <module>r`      s$          0]@qr6   