コード例 #1
0
ファイル: app.py プロジェクト: Flig/mirrormanager2
if APP.config.get('MM_AUTHENTICATION') == 'fas':
    # Use FAS for authentication
    try:
        from flask_fas_openid import FAS
        FAS = FAS(APP)
    except ImportError:
        APP.logger.exception("Couldn't import flask-fas-openid")

import mirrormanager2
import mirrormanager2.lib as mmlib
import mirrormanager2.forms as forms
import mirrormanager2.login_forms as login_forms
import mirrormanager2.lib.model as model

SESSION = mmlib.create_session(APP.config['DB_URL'])


def is_mirrormanager_admin(user):
    """ Is the user a mirrormanager admin.
    """
    if not user:
        return False
    auth_method = APP.config.get('MM_AUTHENTICATION', None)

    if auth_method == 'fas':
        if not user.cla_done or len(user.groups) < 1:
            return False

    if auth_method in ('fas', 'local'):
        admins = APP.config['ADMIN_GROUP']
コード例 #2
0
ファイル: app.py プロジェクト: TroJan/mirrormanager2
    # Use FAS for authentication
    try:
        from flask.ext.fas_openid import FAS
        FAS = FAS(APP)
    except ImportError:
        APP.logger.exception("Couldn't import flask-fas-openid")


import mirrormanager2
import mirrormanager2.lib as mmlib
import mirrormanager2.forms as forms
import mirrormanager2.login_forms as login_forms
import mirrormanager2.lib.model as model


SESSION = mmlib.create_session(APP.config['DB_URL'])


def is_mirrormanager_admin(user):
    """ Is the user a mirrormanager admin.
    """
    if not user:
        return False
    auth_method = APP.config.get('MM_AUTHENTICATION', None)

    if auth_method == 'fas':
        if not user.cla_done or len(user.groups) < 1:
            return False

    if auth_method in ('fas', 'local'):
        admins = APP.config['ADMIN_GROUP']