added permissions to docs/api

added swagger api view
added authentication method to openapi schema
added logo to docs/api
fixed tree and merge schemas
This commit is contained in:
smilerz
2024-03-27 15:45:51 -05:00
parent daf343c5fd
commit 2c12ce3edf
14 changed files with 970 additions and 612 deletions

View File

@@ -160,18 +160,15 @@ class GroupRequiredMixin(object):
def dispatch(self, request, *args, **kwargs):
if not has_group_permission(request.user, self.groups_required):
if not request.user.is_authenticated:
messages.add_message(request, messages.ERROR,
_('You are not logged in and therefore cannot view this page!'))
messages.add_message(request, messages.ERROR, _('You are not logged in and therefore cannot view this page!'))
return HttpResponseRedirect(reverse_lazy('account_login') + '?next=' + request.path)
else:
messages.add_message(request, messages.ERROR,
_('You do not have the required permissions to view this page!'))
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
return HttpResponseRedirect(reverse_lazy('index'))
try:
obj = self.get_object()
if obj.get_space() != request.space:
messages.add_message(request, messages.ERROR,
_('You do not have the required permissions to view this page!'))
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
return HttpResponseRedirect(reverse_lazy('index'))
except AttributeError:
pass