How to use the c2cwsgiutils.auth.auth_view function in c2cwsgiutils

To help you get started, we’ve selected a few c2cwsgiutils 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 camptocamp / tilecloud-chain / tilecloud_chain / views / admin.py View on Github external
def run(self):
        auth_view(self.request)

        if 'command' not in self.request.POST:
            raise pyramid.httpexceptions.HTTPBadRequest("The POST argument 'command' is required")

        command = shlex.split(self.request.POST['command'])

        if command[0] not in self.gene.config.get('server', {}).get('allowed_commands', [
            'generate_tiles', 'generate_controller'
        ]):
            raise pyramid.httpexceptions.HTTPBadRequest(
                "The given executable '{}' is not allowed".format(command[0])
            )
        lt = LogThread(command)
        lt.start()
        return pyramid.httpexceptions.HTTPFound(self.request.route_url('admin'))