From 2585079da1bf118be33e6d252d4030671f3a77f8 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Tue, 12 Feb 2019 01:33:48 -0200 Subject: [PATCH] trata comportamento dos docs acess de docs adms --- sapl/api/views.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sapl/api/views.py b/sapl/api/views.py index 152bf79a1..377f35011 100644 --- a/sapl/api/views.py +++ b/sapl/api/views.py @@ -394,6 +394,20 @@ class _DocumentoAdministrativoViewSet(SaplSetViews['protocoloadm']['documentoadm return qs +class _DocumentoAcessorioAdministrativoViewSet( + SaplSetViews['protocoloadm']['documentoacessorioadministrativo']): + + permission_classes = ( + _DocumentoAdministrativoViewSet.DocumentoAdministrativoPermission, ) + + def get_queryset(self): + qs = super().get_queryset() + + if self.request.user.is_anonymous(): + qs = qs.exclude(documento__restrito=True) + return qs + + SaplSetViews['base']['autor'] = _AutorViewSet.build_class_with_actions() SaplSetViews['materia']['proposicao'] = _ProposicaoViewSet SaplSetViews['parlamentares']['parlamentar'] = _ParlamentarViewSet