From the course: Securing Django Applications
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating a group permissions model - Django Tutorial
From the course: Securing Django Applications
Creating a group permissions model
- Using django Guardian, you can split read write modification, delete permissions into different roles groups. To make sure groups were correctly, you have to create them in a data migration, we're going to be creating two groups. First we need to get the model from the auth app. And then we need to actually create the group. And the first one is for account manager. And the second one is the customer's support group. This will be run as part of the data migration here. And then to actually assign the permissions we need to go into apps. And we need to use the post migrate signal. And whenever the data migration is run, we're going to be making sure that we set up the group permissions. So the groups are created, and then we're going to be assigning the permissions using a small utility function, which is based on django guardians assign perm function. And for the accounts manager, they will have permission to change a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Setting up per-object permissions in Django59s
-
Enabling per-object permissions in Django3m 47s
-
Unit test for per-object permissions in Django2m 48s
-
Creating a group permissions model4m 27s
-
Unit test for access control and group permissions3m 38s
-
Adding activity logs for auditing3m 4s
-
Deleting objects in an audit/compliance-compatible way3m 46s
-
-
-
-
-
-