Ejemplo n.º 1
0
Archivo: auth.py Proyecto: Junar/datal
    def authenticate_credentials(self, auth_key):
        user_id = None
        account_id = None

        account = self.resolve_account(self.request)
        if not account:
            raise exceptions.AuthenticationFailed('Invalid Account.')

        application = self.resolve_application(self.request, auth_key)
        if not application:
            raise exceptions.AuthenticationFailed('Auth Key does not exist.')
        if application.is_public_auth_key(auth_key):
            if not self.check_referer(self.request, application):
                raise exceptions.AuthenticationFailed('Invalid referer')

        user = self.resolve_user(application, account)

        preferences = account.get_preferences()

        return (
            user, {
                'account': account,
                'preferences': preferences,
                'application': application,
                'auth_key': auth_key,
                'language': preferences['account.language'],
                'microsite_domain': get_domain(account.id),
            }
        )
Ejemplo n.º 2
0
    def authenticate_credentials(self, auth_key):
        user_id = None
        account_id = None

        account = self.resolve_account(self.request)
        if not account:
            raise exceptions.AuthenticationFailed('Invalid Account.')

        application = self.resolve_application(self.request, auth_key)
        if not application:
            raise exceptions.AuthenticationFailed('Auth Key does not exist.')
        if application.is_public_auth_key(auth_key):
            if not self.check_referer(self.request, application):
                raise exceptions.AuthenticationFailed('Invalid referer')

        user = self.resolve_user(application, account)

        preferences = account.get_preferences()

        return (user, {
            'account': account,
            'preferences': preferences,
            'application': application,
            'auth_key': auth_key,
            'language': preferences['account.language'],
            'microsite_domain': get_domain(account.id),
        })
Ejemplo n.º 3
0
    def authenticate(self, request):
        if hasattr(request, 'account') and request.account:
            account = request.account

            return (AccountAnonymousUser(account), {
                'account': account,
                'preferences': None,
                'language': request.auth_manager.language,
                'microsite_domain': get_domain(account.id),
            })
Ejemplo n.º 4
0
    def authenticate(self, request):
        if hasattr(request, 'account') and request.account:
            account = request.account

            return (
                AccountAnonymousUser(account), {
                    'account': account,
                    'preferences': None,
                    'language': request.auth_manager.language,
                    'microsite_domain': get_domain(account.id),
                }
            )
Ejemplo n.º 5
0
        template = dsrs[0]["rdf_template"]
        if not template:
            raise MintTemplateNotFoundError("We can't find any template for this datastream revision. %s" % str(dsrs[0]) )

    try:
        t = DataStreamOutputBigDataTemplate(template)
        body = t.render(contents, request)

        # If I don't need validation on BigData we can return the final RDF here.
        if not request.validate:
            return MintTemplateResponse().render(body, template, "It's just a validation. Nothing was send to the BigData Server'", "NO PROCESS. Just validation", "")

        if body == False:
            return MintTemplateResponse().render("NO RDF PROCESS", template, "Error rendering template [%s], NOT A RDF ERROR" % t.render_errors, "FAIL", "Probably filter problem")

        context = get_domain(request.account_id) + '/%s' % request.guid
        b = Bigdata()
        response = b.insert(body, namespace, context, create_if_not_exists=True)
        result = "OK" if b.lastError == "" else "FAIL"

        if b.lastError == "":
            result = "OK"
            response = "OK %s" % response.replace("<","[").replace(">","]")
            fail_type = ""
        else:
            result = "FAIL"
            fail_type = "RDF process problem"

        html_result = MintTemplateResponse().render(body, template, response, result, fail_type)
    except Exception, e:
        logger.error(e)