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
1
vote
1 answer

Django guardian user.has_perm false for existing data

I was trying to give permission using Django guardian. when I try to give permission for existing data its show me a false message but when I create a new object its show me true. what I'm doing wrong? My code : >>>from django.contrib.auth.models…
Antu
  • 2,197
  • 3
  • 25
  • 40
1
vote
1 answer

Permissions not working using django-guardian for djangorestframework

I am trying to add object level permission to my django REST project using django-guardian, but I am getting http://127.0.0.1:8000/api/v1/tasks/ HTTP 403 Forbidden Allow: GET, POST, HEAD, OPTIONS Content-Type: application/json Vary: Accept { …
1
vote
0 answers

Django signals not working on worker

I have django (1.9) application which is implemented with websocket. To implement websocket I use Django channel (1.1.8). My models are under ACL which are managed by Django-guardian (1.4.4). I send message through websocket every time a model named…
1
vote
2 answers

Migrating to django-guardian permissions with custom User class

I am trying to migrate my models to use Guardian permissions. At this point I have: class Data(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) class Meta: permissions = ( …
David R.
  • 855
  • 8
  • 17
1
vote
0 answers

How to get old field value on save_model

I want my projects to have one leader with lead_project permission for individual projects. This Leader is stored as a ForeignKey in the Project class. In my custom ProjectAdmin I managed to assign the permission by defining save_model. class…
Rubick
  • 139
  • 3
  • 11
1
vote
1 answer

Django Signal Triggered But Not Saving

Exactly like the title says. The post_save receiver is being triggered, and permissions are being changed in these methods, but they remain unchanged on the admin page. Here's the model I'm using, stripped to just the part in question. from…
1
vote
0 answers

What is best way to return object permission with instance using Django Rest Framework and django-guardian

I'm using Django Rest Framework and django-guardian (for per object permissions), what is best way to return object permission with instance. For example now request "/api/v1/objects/" returns: { "id":0, "category": "string", "name":…
mikhail
  • 482
  • 1
  • 3
  • 14
1
vote
1 answer

Django: Set is_active = True manually, no way?

For a slew of reasons that detailing will make this post too long, I'm using a custom user model, alongside django-registration, and guardian. Everything is working quite alright, but I'm trying to make it so every user registered is automatically…
zerohedge
  • 3,185
  • 4
  • 28
  • 63
1
vote
1 answer

Custom Group model for Django Guardian

Django guardian requires from django.contrib.auth.models import Group to assign row-level permission to a group. I have my own group model that is NOT an instance of Group. Is there anything I can do about this?
7ball
  • 2,183
  • 4
  • 26
  • 61
1
vote
1 answer

ViewFlow and django-guardian

I want to make use of django-guardian's object permissions and grant specific rights for specific users to one or more Django users. I have tried to add some permissions to my Process class like this: class TestProcess(Process): title =…
Hi Hi
  • 366
  • 4
  • 20
1
vote
2 answers

How to customize DjangoObjectPermissions?

Hi I am following this example of using the DjangoObjectPermissionsFilter. I want to create class SampleModelPermissions(permissions.DjangoObjectPermissions) so that it satisfies the following description in my "self-documented" DRF API: This is…
1
vote
1 answer

Custom and Unmanaged User Model/Lagacy User Table

I am trying to make django-guardian work with my custom User model. The model is inherited from AbstractUser and also from GuardianUserMixin. Here is the User model: class User(AbstractUser, GuardianUserMixin): class Meta: managed =…
khajvah
  • 4,889
  • 9
  • 41
  • 63
1
vote
2 answers

Django rest framework queryset custom permissions

I would like to set custom permissions with django guardian on my django rest framework views. I've successfuly achieved it for RetrieveModelMixin, but not for ListModelMixin. I have a permission class looking like this one : class…
Jbb
  • 483
  • 3
  • 15
1
vote
1 answer

Django Guardian assign_perm and DoesNotExist error

I'm using django-guardian to implement object level permissions. I created custom permissions in the Models and I have migrated & tried resetting migrations and re-migrating, but I still run into a DoesNotExist error: Permission matching query…
1
vote
1 answer

Is there a way to add "public" objects using django-guardian

I am using the great django-guardian to manage per object permissions on a project. In such project I will like all users be granted a permission (view, for instance) to all public objects. As far as I know the only way to do this is granting each…
jdcaballerov
  • 1,452
  • 1
  • 12
  • 16