Django role permissions - available_permissions aren't automatically assigned to Group

323 Views Asked by At

I'm trying to use django-role-permissions but it doesn't assign available_permissions to Group nor to User.

from rolepermissions.roles import AbstractUserRole

class PERMISSIONS:
    CAN_SEE_ALL_INVOICES = 'can_see_all_invoices'
    CAN_SEE_OWN_INVOICES = 'can_see_own_invoices'

class Admin(AbstractUserRole):
    verbose_name = 'Admin'
    available_permissions = {
        PERMISSIONS.CAN_SEE_ALL_INVOICES:True,
    }

class Broker(AbstractUserRole):
    verbose_name = 'Maklér'
    available_permissions = {
        PERMISSIONS.CAN_SEE_ALL_INVOICES: False,
        PERMISSIONS.CAN_SEE_OWN_INVOICES: True,
    }

After sync_roles I checked the admin and also tried to programmatically check the permission for the user that has Broker role and they doesn't have the permission.

How is that possible?

0

There are 0 best solutions below