コード例 #1
0
ファイル: test_authz.py プロジェクト: vzhz/function_generator
    def login_logout(self, username, noidentifier='0'):
        if noidentifier == '1':
            request.environ['repoze.who.plugins'] = {}

        if username == 'logout':
            auth_force_logout()
        else:
            auth_force_login('%s:managers' % username)

        return 'OK'
コード例 #2
0
    def login_logout(self, username, noidentifier='0'):
        if noidentifier == '1':
            request.environ['repoze.who.plugins'] = {}

        if username == 'logout':
            auth_force_logout()
        else:
            auth_force_login('%s:managers' % username)

        return 'OK'
コード例 #3
0
ファイル: root.py プロジェクト: puria/ksweb
    def dashboard(self, share_id):
        user = model.User.query.find({"_id": ObjectId(share_id)}).first()

        if not user:
            response.status_code = 403
            flash(_("You are not allowed to operate in this page"))
            redirect("/start")

        entities = model.Questionary.query.find({
            "$or": [{
                "_user": ObjectId(user._id)
            }, {
                "_owner": ObjectId(user._id)
            }]
        }).sort("title")

        if not entities.count():
            flash(
                _("You don't have any form associated to %s" %
                  user.email_address))
            redirect("/start")

        auth_force_login(user.user_name)
        return dict(
            page="questionary-index",
            fields={
                "columns_name": [
                    _("Title"),
                    _("Owner"),
                    _("Shared with"),
                    _("Created on"),
                    _("Completion %"),
                ],
                "fields_name": [
                    "title",
                    "_owner",
                    "_user",
                    "creation_date",
                    "completion",
                ],
            },
            entities=entities,
            actions=False,
            actions_content=[_("Export")],
            workspace=None,
            show_sidebar=False,
            share_id=share_id,
        )
コード例 #4
0
    def dashboard(self, share_id):
        user = model.User.query.find({'_id': ObjectId(share_id)}).first()

        if not user:
            response.status_code = 403
            flash(_('You are not allowed to operate in this page'))
            redirect('/start')

        entities = model.Questionary.query.find({
            '$or': [{
                '_user': ObjectId(user._id)
            }, {
                '_owner': ObjectId(user._id)
            }]
        }).sort('title')

        if not entities.count():
            flash(
                _('You don\'t have any form associated to %s' %
                  user.email_address))
            redirect('/start')

        auth_force_login(user.user_name)
        return dict(
            page='questionary-index',
            fields={
                'columns_name': [
                    _('Title'),
                    _('Owner'),
                    _('Shared with'),
                    _('Created on'),
                    _('Completion %')
                ],
                'fields_name':
                ['title', '_owner', '_user', 'creation_date', 'completion']
            },
            entities=entities,
            actions=False,
            actions_content=[_('Export')],
            workspace=None,
            show_sidebar=False,
            share_id=share_id)