Browse Source

Use gvacommon from own repository

This commit removes the included gvacommon copy. Gvacommon has its own
development repository and is now added as a dependency via
requirements/base.txt.
remotes/origin/HEAD
Jan Dittberner 6 years ago
parent
commit
5b48a3f2db
  1. 3
      gnuviechadmin/gvacommon/.gitignore
  2. 0
      gnuviechadmin/gvacommon/__init__.py
  3. 15
      gnuviechadmin/gvacommon/celeryrouters.py
  4. 24
      gnuviechadmin/gvacommon/locale/de/LC_MESSAGES/django.po
  5. 42
      gnuviechadmin/gvacommon/viewmixins.py
  6. 1
      requirements/base.txt

3
gnuviechadmin/gvacommon/.gitignore

@ -1,3 +0,0 @@
.*.swp
*.pyc
.ropeproject/

0
gnuviechadmin/gvacommon/__init__.py

15
gnuviechadmin/gvacommon/celeryrouters.py

@ -1,15 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
class GvaRouter(object):
def route_for_task(self, task, args=None, kwargs=None):
for route in ['ldap', 'file', 'mysql', 'pgsql', 'web']:
if route in task:
return {
'exchange': route,
'exchange_type': 'direct',
'queue': route,
}
return None

24
gnuviechadmin/gvacommon/locale/de/LC_MESSAGES/django.po

@ -1,24 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: gvacommon\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-29 11:04+0100\n"
"PO-Revision-Date: 2015-01-24 18:25+0100\n"
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
"Language-Team: Jan Dittberner <jan@dittberner.info>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.6.10\n"
"X-Poedit-SourceCharset: UTF-8\n"
#: gvacommon/viewmixins.py:29
msgid "You are not allowed to view this page."
msgstr "Sie haben nicht die nötigen Berechtigungen um diese Seite zu sehen."

42
gnuviechadmin/gvacommon/viewmixins.py

@ -1,42 +0,0 @@
"""
This module defines mixins for gnuviechadmin views.
"""
from __future__ import unicode_literals
from django.http import HttpResponseForbidden
from django.utils.translation import ugettext as _
from braces.views import LoginRequiredMixin
class StaffOrSelfLoginRequiredMixin(LoginRequiredMixin):
"""
Mixin that makes sure that a user is logged in and matches the current
customer or is a staff user.
"""
def dispatch(self, request, *args, **kwargs):
if (
request.user.is_staff or
request.user == self.get_customer_object()
):
return super(StaffOrSelfLoginRequiredMixin, self).dispatch(
request, *args, **kwargs
)
return HttpResponseForbidden(
_('You are not allowed to view this page.')
)
def get_customer_object(self):
"""
Views based on this mixin have to implement this method to return
the customer that must be an object of the same class as the
django.contrib.auth user type.
:return: customer
:rtype: settings.AUTH_USER_MODEL
"""
raise NotImplemented("subclass has to implement get_customer_object")

1
requirements/base.txt

@ -18,3 +18,4 @@ python-openid==2.2.5
requests==2.9.1
requests-oauthlib==0.6.0
simplejson==3.8.1
-e git+https://git.gnuviech-server.de/gvacommon.git@0.2.1#egg=gvacommon

Loading…
Cancel
Save