1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-14 19:24:27 +03:00

updated requirements

This commit is contained in:
Adolfo Gómez García 2018-10-11 05:43:56 +02:00
parent 78731b2e51
commit e33a6e4712
28 changed files with 107 additions and 42 deletions

View File

@ -8,10 +8,10 @@ lxml==3.6.0
ovirt-engine-sdk-python==4.1.7
pycurl==7.43.0
matplotlib==2.1.2
pyOpenSSL==16.2.0
pyOpenSSL==17.5.0
mysqlclient==1.3.12
python-ldap==3.0.0b4
paramiko==2.4.1
paramiko==2.4.2
defusedxml==0.5.0
python-dateutil==2.6.1
requests==2.18.4

View File

@ -39,7 +39,7 @@ from uds.REST import Handler
from uds.REST import RequestError
from uds.models import TicketStore
from uds.models import User
from uds.web import errors
from uds.web.util import errors
from uds.core.managers import cryptoManager, userServiceManager
from uds.core.util.Config import GlobalConfig
from uds.core.services.Exceptions import ServiceNotReadyError

View File

@ -42,7 +42,7 @@ from uds.core.managers import cryptoManager
from uds.core.ui.images import DEFAULT_THUMB_BASE64
from uds.core.util.Config import GlobalConfig
from uds.core.services.Exceptions import ServiceNotReadyError
from uds.web import errors
from uds.web.util import errors
import datetime
import six

View File

@ -198,6 +198,9 @@ class Config(object):
def enumerate():
GlobalConfig.initialize() # Ensures DB contains all values
for cfg in uds.models.Config.objects.all().order_by('key'): # @UndefinedVariable
# Skip sections with name starting with "__" (not to be editted on configuration)
if cfg.section.startswith('__'): # Hidden section:
continue
logger.debug('{0}.{1}:{2},{3}'.format(cfg.section, cfg.key, cfg.value, cfg.field_type))
if cfg.crypt is True:
val = Config.section(cfg.section).valueCrypt(cfg.key)

View File

@ -33,13 +33,13 @@
from __future__ import unicode_literals
from uds.core.util.html import checkBrowser
from uds.web import errors
from uds.web.util import errors
from functools import wraps
import logging
__updated__ = '2018-06-25'
__updated__ = '2018-10-07'
logger = logging.getLogger(__name__)
@ -56,6 +56,7 @@ def denyBrowsers(browsers=None, errorResponse=lambda request: errors.errorView(r
browsers = ['ie<9']
def wrap(view_func):
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
"""
@ -66,7 +67,9 @@ def denyBrowsers(browsers=None, errorResponse=lambda request: errors.errorView(r
return errorResponse(request)
return view_func(request, *args, **kwargs)
return _wrapped_view
return wrap

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# Copyright (c) 2012-2018 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@ -31,8 +31,6 @@
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
"""
from __future__ import unicode_literals
from django.db import models
import logging

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
{% load i18n uds %}
{% udsJs %}

View File

@ -1,26 +1,27 @@
{% load uds i18n %}{% get_current_language as LANGUAGE_CODE %}<!doctype html>
{% load i18n %}{% get_current_language as LANGUAGE_CODE %}<!doctype html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<meta charset="utf-8">
<title>Uds</title>
<base href="/uds/page">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" href="/uds/res/modern/img/favicon.png">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<!-- just in case translations cannot be loaded, provide a fallback -->
<script type="text/javascript">
django = {
gettext: function(s) {
gettext: function (s) {
return s;
}
}
</script>
<script type="text/javascript" src="{% url 'utility.jsCatalog' LANGUAGE_CODE %}"></script><script type="text/javascript" src="{% url 'utility.js' %}"></script>
<link rel="stylesheet" href="/uds/res/modern/styles.css"></head>
<link rel="stylesheet" href="/uds/res/modern/styles.css"><link rel="stylesheet" href="{% url 'custom' 'styles.css' %}"></head>
<body>
<uds-root></uds-root>

View File

@ -119,6 +119,11 @@ urlpatterns = [
# Authenticators custom html
re_path(r'^uds/webapi/customAuth/(?P<idAuth>.*)$', uds.web.views.customAuth, name='uds.web.views.customAuth'),
# END WEB API
# Costumization of GUI
re_path(r'^uds/custom/(?P<component>[a-zA-Z.-]+)$', uds.web.views.custom.custom, name='custom'),
# REST Api
re_path(r'^uds/rest/(?P<arguments>.*)$', REST.Dispatcher.as_view(), name="REST"),

View File

@ -54,7 +54,7 @@ def transformId(view_func):
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
from uds.web import errors
from uds.web.util import errors
for k in kwargs.keys():
if k[:2] == 'id':
try:

View File

@ -37,7 +37,7 @@ from uds.core.util.Config import GlobalConfig
from uds.core.util.Cache import Cache
from uds.core.util.model import processUuid
import uds.web.errors as errors
import uds.web.util.errors as errors
import logging
logger = logging.getLogger(__name__)

View File

@ -36,12 +36,15 @@ import logging
from django import template
from django.conf import settings
from django.middleware import csrf
from django.utils.translation import gettext, get_language
from django.utils.html import mark_safe
from django.urls import reverse
from django.templatetags.static import static
from uds.REST import AUTH_TOKEN_HEADER
from uds.REST.methods.client import CLIENT_VERSION
from uds.core.managers import downloadsManager
from uds.core.util.Config import GlobalConfig
@ -57,8 +60,7 @@ CSRF_FIELD = 'csrfmiddlewaretoken'
@register.simple_tag(takes_context=True)
def udsJs(context):
request = context['request']
def udsJs(request):
auth_host = request.META.get('HTTP_HOST') or request.META.get('SERVER_NAME') or 'auth_host' # Last one is a placeholder in case we can't locate host name
profile = {
@ -67,7 +69,7 @@ def udsJs(context):
}
# Gets csrf token
csrf_token = context.get('csrf_token')
csrf_token = csrf.get_token(request)
if csrf_token is not None:
csrf_token = str(csrf_token)
@ -107,6 +109,7 @@ def udsJs(context):
'changeLang': reverse('set_language'),
'login': reverse('page.login'),
'logout': reverse('page.logout'),
'user': reverse('page.index'),
'customAuth': reverse('uds.web.views.customAuth', kwargs={'idAuth': ''}),
'services': reverse('webapi.services'),
'enabler': reverse('webapi.enabler', kwargs={ 'idService': 'param1', 'idTransport': 'param2' }),
@ -135,8 +138,16 @@ def udsJs(context):
actors = []
if profile['role'] == 'staff': # Add staff things
# If is admin (informational, REST api checks users privileges anyway...)
profile['admin'] = True;
# REST auth
config['auth_token'] = request.session.session_key
config['auth_header'] = AUTH_TOKEN_HEADER
# Actors
actors = [{'url': reverse('utility.downloader', kwargs={'idDownload': key}), 'name': val['name'], 'description': gettext(val['comment'])} for key, val in downloadsManager().getDownloadables().items()]
# URLS
config['urls']['admin'] = reverse('uds.admin.views.index')
config['urls']['rest'] = reverse('REST', kwargs={'arguments': ''})
errors = []
if 'errors' in request.session:
@ -152,6 +163,5 @@ def udsJs(context):
'data': request.session.get('data')
}
javascript = 'var udsData = ' + json.dumps(uds) + ';\n';
return 'var udsData = ' + json.dumps(uds) + ';\n'
return mark_safe(javascript);

View File

@ -36,11 +36,12 @@ import logging
from .service import transportOwnLink, transportIcon, clientEnabler, serviceImage, action
from .auth import authCallback, authInfo, ticketAuth, customAuth
from .download import download
from ..errors import error
from uds.web.util.errors import error
from .images import image
from .file_storage import file_storage
from . import modern
from . import custom
__updated__ = '2018-09-28'
__updated__ = '2018-10-04'
logger = logging.getLogger(__name__)

View File

@ -38,7 +38,7 @@ from django.utils.translation import ugettext as _
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
import uds.web.errors as errors
import uds.web.util.errors as errors
from uds.core.auths.Exceptions import InvalidUserException
from uds.core.auths.auth import webLogin, webLogout, authenticateViaCallback, authLogLogin, getUDSCookie
from uds.core.managers import userServiceManager, cryptoManager

View File

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
from uds.core.util.Config import Config
# @cache_page(3600, key_prefix='custom', cache='memory')
def custom(request, component):
content_type = 'text/plain'
value = ''
if component == 'styles.css':
content_type = 'text/css'
value = Config.section('__custom').value('style').get(force=True)
return HttpResponse(content_type=content_type, content=value)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# Copyright (c) 2012-2018 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@ -28,7 +28,6 @@
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from __future__ import unicode_literals
from uds.core.auths.auth import webLoginRequired
from uds.core.managers.DownloadsManager import DownloadsManager
@ -38,7 +37,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2018-09-28'
__updated__ = '2018-10-04'
@webLoginRequired(admin=True)

View File

@ -44,7 +44,7 @@ from uds.web.authentication import checkLogin
from uds.core.ui import theme
from uds.core import VERSION
import uds.web.errors as errors
import uds.web.util.errors as errors
import logging
logger = logging.getLogger(__name__)

View File

@ -34,7 +34,7 @@ import json
from django.shortcuts import render
from django.http import HttpResponse
from django.urls import reverse
from uds.web.errors import errorView
from uds.web.util.errors import errorView
from uds.core.auths.auth import (
getUDSCookie,
denyNonAuthenticated,
@ -42,7 +42,8 @@ from uds.core.auths.auth import (
authLogLogout,
webLogout,
)
from uds.web.services import getServicesData
from uds.web.util.services import getServicesData
from uds.web.util import configjs
logger = logging.getLogger(__name__)
@ -62,7 +63,7 @@ def index(request):
# Basically, the original /login method, but fixed for modern interface
def login(request, tag=None):
from uds.web.forms.LoginForm import LoginForm
from uds.web.authentication import checkLogin
from uds.web.util.authentication import checkLogin
from uds.core.auths.auth import webLogin
from django.http import HttpResponseRedirect
@ -97,7 +98,7 @@ def logout(request):
def js(request):
return render(request, 'uds/js.js', content_type='text/javascript')
return HttpResponse(content=configjs.udsJs(request), content_type='application/javascript')
@denyNonAuthenticated

View File

@ -43,15 +43,15 @@ from uds.models import Transport, Image
from uds.core.util import html, log
from uds.core.services.Exceptions import ServiceNotReadyError, MaxServicesReachedError, ServiceAccessDeniedByCalendar
from uds.web import errors
from uds.web import services
from uds.web.util import errors
from uds.web.util import services
import json
import logging
logger = logging.getLogger(__name__)
__updated__ = '2018-09-27'
__updated__ = '2018-10-07'
@webLoginRequired(admin=False)