# -*- coding: utf-8 -*-
"""
This is an example controller demonstrating one way to
use AuthKit to restrict access
"""

import logging

from pylons import request, tmpl_context as c
from {{package}}.lib.base import BaseController, render


from authkit.authorize.pylons_adaptors import authorize
from authkit.permissions import RemoteUser
from {{package}}.lib.helpers import dcmeta

log = logging.getLogger(__name__)

permissions = RemoteUser()

class HelloController(BaseController):

    def __before__(self):
        c.dcmeta = dcmeta()

    def index(self):
        from pprint import pformat
        c.controller_name = 'account'
        c.reqenv = pformat(request.environ)
        c.auth_user = request.environ.get('REMOTE_USER', '')
        c.title = "Shabti AuthKit installation."
        return render('/dri.mak')

    @authorize(permissions)
    def private(self):
        return 'This is private'
