vittoriozamboni / django-groups-manager

Manage django groups collection based on django-mptt.
MIT License
100 stars 23 forks source link

Extend the downstream permissions with roles #27

Closed Allan-Nava closed 6 years ago

Allan-Nava commented 6 years ago

I bugfixed the assign_object()

team   = Group.objects.create(name=society.name, group_type=g_type, parent=society) 
member = Member.objects.get(django_user=user)
team.add_member(member, roles = [GroupMemberRole.OWNER])

But when I try to modify the groups_downstream I have error:

this is example:
'PERMISSIONS': {
        'owner': ['view', 'change', 'delete'],
        'group': ['view', 'change'],
        'groups_upstream': ['view'],
        'groups_downstream': [],
        'groups_siblings': ['view'],
    },

this is my:
PERMISSIONS = {
    #'owner': ['view', 'change', 'delete',],
    'owner': {
        'leader': ['change', 'delete', 'can_add_member_custom', 'can_remove_member_custom'], 
        'referent': ['change', 'delete', 'can_add_member_custom', 'can_remove_member_custom'],
        'default': ['view', 'change', 'delete'],
    },
    'group': ['view', 'change',],
    'groups_upstream': ['view'],
    'groups_downstream': {
        'leader': ['change', 'delete', 'can_add_member_custom', 'can_remove_member_custom'], 
        'referent': ['change', 'delete', 'can_add_member_custom', 'can_remove_member_custom' ], 
        #'default': ['view']
    },
    'groups_siblings': ['view'],
}

Is possibile have the role permission for downstream permss?

Thanks

this is error: Permission matching query does not exist.