How to use the orchestra.contrib.saas.settings function in orchestra

To help you get started, we’ve selected a few orchestra examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glic3rinu / django-orchestra / orchestra / contrib / saas / backends / moodle.py View on Github external
def get_context(self, saas):
        context = {
            'banner': self.get_banner(),
            'name': saas.name,
            'site_name': saas.name,
            'full_name': "%s course" % saas.name.capitalize(),
            'moodle_path': settings.SAAS_MOODLE_PATH,
            'user': settings.SAAS_MOODLE_SYSTEMUSER,
            'db_user': settings.SAAS_MOODLE_DB_USER,
            'db_pass': settings.SAAS_MOODLE_DB_PASS,
            'db_name': settings.SAAS_MOODLE_DB_NAME,
            'db_host': settings.SAAS_MOODLE_DB_HOST,
            'db_prefix': saas.name.replace('-', '_'),
            'email': saas.account.email,
            'password': getattr(saas, 'password', None),
            'custom_url': saas.custom_url.rstrip('/'),
            'custom_domain': urlparse(saas.custom_url).netloc if saas.custom_url else None,
        }
        context.update({
            'crontab': settings.SAAS_MOODLE_CRONTAB % context,
            'db_name': context['db_name'] % context,
            'moodledata_path': settings.SAAS_MOODLE_DATA_PATH % context,
        })
github glic3rinu / django-orchestra / orchestra / contrib / saas / backends / bscw.py View on Github external
def get_context(self, saas):
        context = {
            'bsadmin': settings.SAAS_BSCW_BSADMIN_PATH,
            'email': saas.data.get('email'),
            'username': saas.name,
            'password': getattr(saas, 'password', None),
        }
        return replace(context, "'", '"')
github glic3rinu / django-orchestra / orchestra / contrib / saas / backends / dokuwikimu.py View on Github external
def get_context(self, saas):
        context = super(DokuWikiMuController, self).get_context(saas)
        domain = saas.get_site_domain()
        context.update({
            'template': settings.SAAS_DOKUWIKI_TEMPLATE_PATH,
            'farm_path': os.path.normpath(settings.SAAS_DOKUWIKI_FARM_PATH),
            'app_path': os.path.join(settings.SAAS_DOKUWIKI_FARM_PATH, domain),
            'user': settings.SAAS_DOKUWIKI_USER,
            'group': settings.SAAS_DOKUWIKI_GROUP,
            'email': saas.account.email,
            'custom_url': saas.custom_url,
            'domain': domain,
        })
        if saas.custom_url:
            custom_url = urlparse(saas.custom_url)
            context.update({
                'custom_domain': custom_url.netloc,
            })
        password = getattr(saas, 'password', None)
        salt = random_ascii(8)
        context.update({
            'password': crypt.crypt(password, '$1$'+salt) if password else None,
            'users_path': os.path.join(context['app_path'], 'conf/users.auth.php'),
        })
        return context
github glic3rinu / django-orchestra / orchestra / contrib / saas / services / moodle.py View on Github external
class MoodleForm(SaaSPasswordForm):
    admin_username = forms.CharField(label=_("Admin username"), required=False,
        widget=SpanWidget(display='admin'))


class MoodleService(SoftwareService):
    name = 'moodle'
    verbose_name = "Moodle"
    form = MoodleForm
    description_field = 'site_name'
    icon = 'orchestra/icons/apps/Moodle.png'
    site_domain = settings.SAAS_MOODLE_DOMAIN
    allow_custom_url = settings.SAAS_MOODLE_ALLOW_CUSTOM_URL
    db_name = settings.SAAS_MOODLE_DB_NAME
    db_user = settings.SAAS_MOODLE_DB_USER
github glic3rinu / django-orchestra / orchestra / contrib / saas / services / seafile.py View on Github external
help_text=_("Disk quota in MB."))


class SeaFileDataSerializer(serializers.Serializer):
    email = serializers.EmailField(label=_("Email"))
    quota = serializers.IntegerField(label=_("Quota"), default=settings.SAAS_SEAFILE_DEFAULT_QUOTA,
            help_text=_("Disk quota in MB."))


class SeaFileService(SoftwareService):
    name = 'seafile'
    verbose_name = "SeaFile"
    form = SeaFileForm
    serializer = SeaFileDataSerializer
    icon = 'orchestra/icons/apps/seafile.png'
    site_domain = settings.SAAS_SEAFILE_DOMAIN
    change_readonly_fields = ('email',)
github glic3rinu / django-orchestra / orchestra / contrib / saas / backends / wordpressmu.py View on Github external
def get_main_url(self):
        main_url = settings.SAAS_WORDPRESS_MAIN_URL
        return main_url.rstrip('/')
github glic3rinu / django-orchestra / orchestra / contrib / saas / backends / dokuwikimu.py View on Github external
salt = random_ascii(8)
        context.update({
            'password': crypt.crypt(password, '$1$'+salt) if password else None,
            'users_path': os.path.join(context['app_path'], 'conf/users.auth.php'),
        })
        return context


class DokuWikiMuTraffic(ApacheTrafficByHost):
    __doc__ = ApacheTrafficByHost.__doc__
    verbose_name = _("DokuWiki MU Traffic")
    default_route_match = "saas.service == 'dokuwiki'"
    doc_settings = (settings,
        ('SAAS_TRAFFIC_IGNORE_HOSTS', 'SAAS_DOKUWIKI_LOG_PATH')
    )
    log_path = settings.SAAS_DOKUWIKI_LOG_PATH
github glic3rinu / django-orchestra / orchestra / contrib / saas / services / options.py View on Github external
def get_plugins(cls, all=False):
        if all:
            for module in os.listdir(os.path.dirname(__file__)):
                if module not in ('options.py', '__init__.py') and module[-3:] == '.py':
                    importlib.import_module('.'+module[:-3], __package__)
            plugins = super().get_plugins()
        else:
            plugins = []
            for cls in settings.SAAS_ENABLED_SERVICES:
                plugins.append(import_class(cls))
        return plugins
github glic3rinu / django-orchestra / orchestra / contrib / saas / backends / owncloud.py View on Github external
def api_call(self, action, url_path, *args, **kwargs):
        BASE_URL = settings.SAAS_OWNCLOUD_API_URL.rstrip('/')
        url = '/'.join((BASE_URL, url_path))
        response = action(url, *args, **kwargs)
        self.validate_response(response)
        return response
github glic3rinu / django-orchestra / orchestra / contrib / saas / services / dokuwiki.py View on Github external
from urllib.parse import urlparse

from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _

from .options import SoftwareService
from .. import settings


class DokuWikiService(SoftwareService):
    name = 'dokuwiki'
    verbose_name = "Dowkuwiki"
    icon = 'orchestra/icons/apps/Dokuwiki.png'
    site_domain = settings.SAAS_DOKUWIKI_DOMAIN
    allow_custom_url = settings.SAAS_DOKUWIKI_ALLOW_CUSTOM_URL
    
    def clean(self):
        if self.allow_custom_url and self.instance.custom_url:
            url = urlparse(self.instance.custom_url)
            if url.path and url.path != '/':
                raise ValidationError({
                    'custom_url': _("Support for specific URL paths (%s) is not implemented.") % url.path
                })
        super(DokuWikiService, self).clean()