Exemplo n.º 1
0
import os
import base64

import colony

import crypton

from .base import BaseController

CONSUMER_STATUS_ACTIVE = 1
""" The consumer active status """

DEFAULT_NUMBER_BITS = 256
""" The default number of bits """

models = colony.__import__("models")

class SignatureController(BaseController):

    def encrypt(self, request, api_key, key_name, message):
        # retrieves the ssl plugin
        ssl_plugin = self.plugin.ssl_plugin

        # creates the ssl structure
        ssl_structure = ssl_plugin.create_structure({})

        # validates the api key
        self._validate_api_key(request, api_key)

        # retrieves the public key path for the key name
        public_key_path = self._get_key_path(key_name, "public_key")
Exemplo n.º 2
0
#
# You should have received a copy of the Apache License along with
# Hive Colony Framework. If not, see <http://www.apache.org/licenses/>.

__author__ = "João Magalhães <*****@*****.**>"
""" The author(s) of the module """

__version__ = "1.0.0"
""" The version of the module """

__revision__ = "$LastChangedRevision$"
""" The revision number of the module """

__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2016 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Apache License, Version 2.0"
""" The license for the module """

import colony

controllers = colony.__import__("controllers")

class BaseController(controllers.Controller):

    def __init__(self, plugin, system):
        controllers.Controller.__init__(self, plugin, system)
Exemplo n.º 3
0
""" The revision number of the module """

__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Hive Solutions Confidential Usage License (HSCUL)"
""" The license for the module """

import colony

from .base import BaseController

mvc_utils = colony.__import__("mvc_utils")


class StreamController(BaseController):
    def data(self, request, parameters={}):
        pass

    def changed(self, request, parameters={}):
        # retrieves the name of the operation to be processed
        # resulting from a change in the communication system
        operation = parameters.get("operation", None)
        if not operation: return

        # uses the name of the operation to route the call properly
        # based on the prefix of the method
        method = getattr(self, operation)
Exemplo n.º 4
0
__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Apache License, Version 2.0"
""" The license for the module """

import sys

import colony

from .base import BaseController

mvc_utils = colony.__import__("mvc_utils")

class MainController(BaseController):

    def index(self, request):
        # generates and processes the template with the provided values
        # changing the current request accordingly, note that there's
        # a defined partial page and a base template value defined
        self._template(
            request = request,
            template = "general/index.html.tpl",
            title = "Colony Framework",
            area = "home"
        )

    def plugins(self, request):
Exemplo n.º 5
0
__revision__ = "$LastChangedRevision$"
""" The revision number of the module """

__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Hive Solutions Confidential Usage License (HSCUL)"
""" The license for the module """

import colony

controllers = colony.__import__("controllers")

class BaseController(controllers.Controller):

    def __init__(self, plugin, system):
        controllers.Controller.__init__(self, plugin, system)

    def validate(self, request, parameters, validation_parameters):
        return self.system.require_permissions(request, validation_parameters)

    def template_file(self, template = "general.html.tpl", *args, **kwargs):
        return self.retrieve_template_file(
            file_path = template,
            *args,
            **kwargs
        )