'Return a list of permission strings that this user has through their
groups. Query all available auth backends. If an object is passed in,
return only permissions matching this object.'

def get_group_permissions(self, obj=None):

    permissions = set()
    for backend in auth.get_backends():
        if hasattr(backend, 'get_group_permissions'):
            permissions.update(backend.get_group_permissions(self, obj))
    return permissions
