'Returns a list of permission strings that this user has through
his/her groups. This method queries all available auth backends.
If an object is passed in, only permissions matching this object
are returned.'

def get_group_permissions(self, obj=None):

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