def connection_resolver(self, resolver, connection, default_manager, filterset_class, filtering_args,
                         root, args, context, info):
     if self.has_perm(context) is not True:
         return DjangoConnectionField.connection_resolver(
             resolver, connection, [PermissionDenied('Permission Denied'), ], root, args, context, info)
     return super(AuthDjangoFilterConnectionField, self).connection_resolver(
         resolver, connection, default_manager, filterset_class, filtering_args,
         root, args, context, info)
Ejemplo n.º 2
0
 def connection_resolver(self, resolver, connection, default_manager,
                         max_limit, enforce_first_or_last, filterset_class,
                         filtering_args, root, args, context, info):
     """
     Resolve the required connection if the user in context has the permission required. If the user
     does not have the required permission then returns a *Permission Denied* to the request.
     """
     assert self._permissions is not None
     if has_perm(self._permissions, context) is not True:
         print(DjangoConnectionField)
         return DjangoConnectionField.connection_resolver(
             resolver, connection, [
                 PermissionDenied('Permission Denied'),
             ], max_limit, enforce_first_or_last, root, args, context, info)
     return super(AuthDjangoFilterConnectionField,
                  self).connection_resolver(resolver, connection,
                                            default_manager, max_limit,
                                            enforce_first_or_last,
                                            filterset_class, filtering_args,
                                            root, args, context, info)