mirror of
				https://github.com/django/django.git
				synced 2025-11-03 21:25:09 +00:00 
			
		
		
		
	Fixed #25166 -- Clarified how auth permissions are created.
Thanks Baptiste Mispelon for report and review.
This commit is contained in:
		
							parent
							
								
									c6da621def
								
							
						
					
					
						commit
						217f173be0
					
				
					 2 changed files with 8 additions and 6 deletions
				
			
		| 
						 | 
					@ -281,11 +281,12 @@ can or cannot do with Task instances, specific to your application::
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The only thing this does is create those extra permissions when you run
 | 
					The only thing this does is create those extra permissions when you run
 | 
				
			||||||
:djadmin:`manage.py migrate <migrate>`. Your code is in charge of checking the
 | 
					:djadmin:`manage.py migrate <migrate>` (the function that creates permissions
 | 
				
			||||||
value of these permissions when a user is trying to access the functionality
 | 
					is connected to the :data:`~django.db.models.signals.post_migrate` signal).
 | 
				
			||||||
provided by the application (viewing tasks, changing the status of tasks,
 | 
					Your code is in charge of checking the value of these permissions when a user
 | 
				
			||||||
closing tasks.) Continuing the above example, the following checks if a user may
 | 
					is trying to access the functionality provided by the application (viewing
 | 
				
			||||||
view tasks::
 | 
					tasks, changing the status of tasks, closing tasks.) Continuing the above
 | 
				
			||||||
 | 
					example, the following checks if a user may view tasks::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    user.has_perm('app.view_task')
 | 
					    user.has_perm('app.view_task')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -205,7 +205,8 @@ These permissions will be created when you run :djadmin:`manage.py migrate
 | 
				
			||||||
will be created for all previously-installed models, as well as for any new
 | 
					will be created for all previously-installed models, as well as for any new
 | 
				
			||||||
models being installed at that time. Afterward, it will create default
 | 
					models being installed at that time. Afterward, it will create default
 | 
				
			||||||
permissions for new models each time you run :djadmin:`manage.py migrate
 | 
					permissions for new models each time you run :djadmin:`manage.py migrate
 | 
				
			||||||
<migrate>`.
 | 
					<migrate>` (the function that creates permissions is connected to the
 | 
				
			||||||
 | 
					:data:`~django.db.models.signals.post_migrate` signal).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Assuming you have an application with an
 | 
					Assuming you have an application with an
 | 
				
			||||||
:attr:`~django.db.models.Options.app_label` ``foo`` and a model named ``Bar``,
 | 
					:attr:`~django.db.models.Options.app_label` ``foo`` and a model named ``Bar``,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue