Questions tagged [django-guardian]

django-guardian is an implementation of per object permissions on top of Django's authorization backend

django-guardian is an implementation of per object permissions [1] on top of Django's authorization backend,

Online documentation is available at https://django-guardian.readthedocs.io/.

140 questions
0
votes
1 answer

Get all objects' django guardian permissions of the authenticated user in template

I have an application where I am using django-guardian for object-level permission. In my ListView, I am listing all my instances in a table. In each row, I need to show the edit button if the user has the permission to edit this object. So, I doing…
Yasser Mohsen
  • 1,411
  • 1
  • 12
  • 29
0
votes
1 answer

Implement Django permissions per group per user's companies

I have a CustomUser model, each user could be linked to multiple companies. I have initiated my application with 3 generic Django groups; viewer, editor, and supervisor and each user could be a member in only one group. class…
0
votes
0 answers

Is there a way to capture permission change in Django Guardian?

I would like to receive a signal after permission is changed on the object level. Django Guardian allows us to set object-level permissions. Based on the permission change, I'd like to perform some actions. How to receive a signal on object level…
0
votes
0 answers

"permission matching query does not exist" errors i encounter with django guardian

Am trying to enable my website users block other users they don't want again as friends just like we can on Facebook. I decided to implement it with Django guardian. when a user clicks a button, a view(block_user_view) is called and the profile the…
0
votes
1 answer

Weird behavior with model/object permissions and viewsets (Django REST framework)

I am experiencing some weird behavior where djangorestframework returns a 404 when trying to browse the browsable API, but attaching a ?format=json at the end returns a normal…
Slav
  • 147
  • 2
  • 13
0
votes
0 answers

Allow only the owners of the parent model to create a child model when utilising generic views (django-guardian)

Currently, I have two models, Parent and Child, with a one-to-many relationship. I am using the built-in generic class-based views for CRUD upon a Parent, where I'm using a django-guardian mixin to prevent users who do not own the Parent object from…
buttery
  • 11
  • 3
0
votes
1 answer

In Django guardian, how can I determine which group gave the user permissions to the object instance?

I am trying to set up object-level permissions using Django guardian and groups; where I give permissions to the groups - not the users - and add/remove users from the groups as required. When a user has permission to interact with an object…
Ben
  • 2,143
  • 2
  • 19
  • 27
0
votes
1 answer

Check permissions for serialized child objects using Guardian

I have three models where one Document has many Blocks and one Block has many Comments. class Document(models.Model): name = models.Charfield() class Block(models.Model): document = models.ForeignKey(to=Document) class Comment block =…
nehalem
  • 397
  • 2
  • 20
0
votes
1 answer

Object permissions in Django Rest Framework

I am trying to do something which seems so straight-forward with Django Rest Framework and object permissions but there doesn't seem to be a simple way to go about it. Here are the (simplified) models I am talking about:- class Team(models.Model): …
bodger
  • 1,112
  • 6
  • 24
0
votes
1 answer

Django Extending class based view dynamically

Is there a good way to dynamically choose which view I want to extend in my class based view in Django? Right now I have 2 views(update and view) as follows that I would like to collapse into 1: from django.views.generic import UpdateView,…
user3246693
  • 679
  • 11
  • 22
0
votes
0 answers

Upper limit for Django group membership?

Is there an upper limit(hard or soft) to how many users can be added to a group in Django? Curious about technical limitations as well as general best practices(eg: don't add more than 10 million users to 1 group or the 4 horsemen of the apocalypse…
user3246693
  • 679
  • 11
  • 22
0
votes
1 answer

use django-guardian with Custom User

I use custom user And i want to django-guardian to handle the permissions and groups. How i can do that my user: class ProfileUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(_('email address'), unique=True) is_staff =…
Alami
  • 45
  • 1
  • 6
0
votes
0 answers

How to implement django guardian to restrict user access to model instances

I'm building an app in which users will be able to upload data for specific "sites", defined by the class below: class Site(models.Model): name = models.CharField(max_length=150) code = models.CharField(max_length=10) date_added =…
ad_intra
  • 93
  • 8
0
votes
1 answer

How to check django-guardian get_objects_for_user permissions via ForeignKey

I have two Django Models of the form: from django.db import models class Car(models.Model): pass class Wheel(models.Model): car = models.ForeignKey(Car, related_name='wheels', on_delete=models.CASCADE) I am using django-guardian to…
phoenix
  • 7,988
  • 6
  • 39
  • 45
0
votes
1 answer

When to use Django Permissions?

AFAIK, permissions do not filter the queryset. Django queryset permissions So, if i have to filter the queryset and return relevant records, what are permissions for? Is there something permission does which filtering cannot?
Rounak
  • 613
  • 3
  • 8
  • 22