• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python usermanagement.check_perms函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中usermanagement.check_perms函数的典型用法代码示例。如果您正苦于以下问题:Python check_perms函数的具体用法?Python check_perms怎么用?Python check_perms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了check_perms函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: indicators

def indicators(indicatorgroup=None):
    its = {}
    indicators = dqindicators.indicatorsTests(indicatorgroup)

    indicatorgroup = dqindicators.indicatorGroups(indicatorgroup)

    for indicator in indicators:
        ind_id = indicator.Indicator.id
        if ind_id not in its:
            its[ind_id] = {}
        its[ind_id].update(indicator.Indicator.as_dict())
        its[ind_id]["indicator_type"] = its[ind_id]["indicator_type"].title()
        if its[ind_id]["indicator_category_name"]:
            its[ind_id]["indicator_type"] += " - " + its[ind_id]["indicator_category_name"]
        if True:
            if ('test' not in its[ind_id]):
                its[ind_id]['test'] = []
        if indicator.Test:
            test_data = indicator.Test.as_dict()
            test_data['test_id'] = test_data['id']
            del(test_data['id'])
            its[ind_id]['test'].append(test_data)
        its[ind_id]["links"] = {
            "edit": url_for('indicators_edit', 
                            indicatorgroup=indicatorgroup.name, 
                            indicator=indicator.Indicator.name),
            "delete": url_for('indicators_delete', 
                              indicatorgroup=indicatorgroup.name, 
                              indicator=indicator.Indicator.name)
            }

    its = util.resort_indicator_tests(its)

    links = {
        "edit_group": url_for('indicatorgroups_edit', 
                              indicatorgroup=indicatorgroup.name),
        "delete_group": url_for('indicatorgroups_delete', 
                                indicatorgroup=indicatorgroup.name),
        "new_indicator": url_for('indicators_new', 
                                 indicatorgroup=indicatorgroup.name),
        "csv_assoc_tests": url_for('indicatorgroup_tests_csv', 
                                   indicatorgroup=indicatorgroup.name),
        "csv_unassoc_tests": url_for('indicatorgroup_tests_csv', 
                                     indicatorgroup=indicatorgroup.name,
                                     option="no")
        }

    indicator_data = [ v for k,v in its.items() ]

    json_data = json.dumps({ 
            "indicator": indicator_data,
            "indicatorgroup": indicatorgroup.as_dict(),
            "admin": usermanagement.check_perms('admin'),
            "links": links
            }, indent=2)

    return render_template("indicators.html", 
                        admin=usermanagement.check_perms('admin'),
                        loggedinuser=current_user,
                        json_data=json_data)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:60,代码来源:indicators.py


示例2: indicatorgroups

def indicatorgroups():
    if not usermanagement.check_perms('admin'):
        return redirect(url_for('indicators', indicatorgroup=app.config["INDICATOR_GROUP"]))
    indicatorgroups = dqindicators.indicatorGroups()
    return render_template("indicatorgroups.html", indicatorgroups=indicatorgroups,
                         admin=usermanagement.check_perms('admin'),
                         loggedinuser=current_user)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:7,代码来源:indicators.py


示例3: organisation_conditions

def organisation_conditions(id=None):
    if id is not None:
        pc = get_pc(id)
        return render_template("organisation_condition.html", pc=pc,
             admin=usermanagement.check_perms('admin'),
             loggedinuser=current_user)
    else:
        pcs = get_pcs()
        return render_template("organisation_conditions.html", pcs=pcs,
             admin=usermanagement.check_perms('admin'),
             loggedinuser=current_user)
开发者ID:mk270,项目名称:IATI-Data-Quality,代码行数:11,代码来源:publisher_conditions.py


示例4: organisations_index

def organisations_index(organisation_code=None):
    
    aggregation_type=integerise(request.args.get('aggregation_type', 2))

    template_args = {}
    org_packages = dqorganisations.organisationPackages(organisation_code)

    organisation = dqorganisations.organisations(organisation_code)
    packagegroups = dqorganisations.organisationPackageGroups(organisation_code)

    irs = [ir for ir in get_info_results(org_packages, organisation)]
    coverage = get_coverage(organisation, irs)

    organisation_survey = dqsurveys.getSurvey(organisation_code)

    surveydata = dqsurveys.getSurveyDataAllWorkflows(organisation_code)

    surveydata, _ = dqsurveys.get_survey_data_and_workflow(
        organisation_survey, surveydata)

    summary_data = get_summary_data(organisation, aggregation_type)

    allowed_to_view_survey = usermanagement.check_perms(
        "survey",
        "view")
    allowed_to_edit_survey_researcher = usermanagement.check_perms(
        "survey_researcher",
        "edit",
        {"organisation_code": organisation_code})

    show_researcher_button = (
        allowed_to_edit_survey_researcher and
         (
          (organisation_survey and
           organisation_survey.Workflow.name == 'researcher')
           or
          (not organisation_survey)
         )
        )

    template_args = dict(organisation=organisation,
                         summary_data=summary_data,
                         packagegroups=packagegroups,
                         coverage=coverage,
                         surveydata=surveydata,
                         admin=usermanagement.check_perms('admin'),
                         loggedinuser=current_user,
                         allowed_to_view_survey=allowed_to_view_survey,
                         show_researcher_button=show_researcher_button)

    return render_template("organisation_index.html", **template_args)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:51,代码来源:organisations.py


示例5: organisations

def organisations(organisation_code=None):
    check_perms = usermanagement.check_perms('organisation', 'view', {'organisation_code':organisation_code})
    if organisation_code is not None:
        if check_perms:
            return redirect(url_for('organisations_index', organisation_code=organisation_code))
        else:
            return redirect(url_for('organisation_publication', organisation_code=organisation_code))
    else:
        organisations = dqorganisations.organisations()

        template_args = dict(organisations=organisations,
                         admin=usermanagement.check_perms('admin'),
                         loggedinuser=current_user)

        return render_template("organisations.html", **template_args)
开发者ID:mk270,项目名称:IATI-Data-Quality,代码行数:15,代码来源:organisations.py


示例6: ipc_step2

def ipc_step2():
    step = "2"
    if request.method != "POST":
        return

    from iatidq import dqimportpublisherconditions

    def get_results():
        if request.form.get("local"):
            return dqimportpublisherconditions.importPCsFromFile()
        else:
            url = request.form["url"]
            return dqimportpublisherconditions.importPCsFromUrl(url)

    results = get_results()

    if results:
        flash("Parsed conditions", "success")
        return render_template(
            "import_organisation_conditions_step2.html",
            results=results,
            step=step,
            admin=usermanagement.check_perms("admin"),
            loggedinuser=current_user,
        )
    else:
        flash("There was an error importing your conditions", "error")
        return redirect(url_for("import_organisation_conditions"))
开发者ID:shreyabasu,项目名称:IATI-Data-Quality,代码行数:28,代码来源:publisher_conditions.py


示例7: ipc_step2

def ipc_step2():
    step = '2'
    if request.method != 'POST':
        return

    from iatidq import dqimportpublisherconditions

    def get_results():
        if request.form.get('local'):
            return dqimportpublisherconditions.importPCsFromFile()
        else:
            url = request.form['url']
            return dqimportpublisherconditions.importPCsFromUrl(url)

    results = get_results()

    ## FIXME: duplicate code?
    if results:
        flash('Parsed conditions', "success")
        return render_template(
            "import_organisation_conditions_step2.html", 
            results=results, 
            step=step,
            admin=usermanagement.check_perms('admin'),
            loggedinuser=current_user)
    else:
        flash('There was an error importing your conditions', "error")
        return redirect(url_for('import_organisation_conditions'))
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:28,代码来源:publisher_conditions.py


示例8: users_edit

def users_edit(username=None):
    if username:
        user = dqusers.user_by_username(username)
        permissions = dqusers.userPermissions(user.id)
        if request.method == 'POST':
            if user:
                flash('Successfully updated user.', 'success')
            else:
                user = {}
                flash('Could not update user.', 'error')
    else:
        if request.method == 'POST':
            user = dqusers.addUser({
                    'username': request.form['username'],
                    'password': request.form['password'],
                    'name': request.form['name'],
                    'email_address': request.form['email_address'],
                    'organisation': request.form['organisation']
                    })
            if user:
                flash('Successfully added new user', 'success')
            else:
                flash('Could not add user user', 'error')
        else:
            user = {}
            permissions = {}

    return render_template("users_edit.html", 
                           user=user,
                           permissions=permissions,
             admin=usermanagement.check_perms('admin'),
             loggedinuser=current_user)
开发者ID:mk270,项目名称:IATI-Data-Quality,代码行数:32,代码来源:users.py


示例9: indicators_new

def indicators_new(indicatorgroup=None):
    indicatorgroups = dqindicators.indicatorGroups()
    if (request.method == 'POST'):
        data = {
            'name': request.form['name'],
            'description': request.form['description'],
            'indicatorgroup_id': request.form['indicatorgroup_id'],
            'longdescription': request.form.get("longdescription"),
            'indicator_type': request.form.get("indicator_type"),
            'indicator_category_name': request.form.get("indicator_category_name"),
            'indicator_subcategory_name': request.form.get("indicator_subcategory_name"),
            'indicator_ordinal': request.form.get("indicator_ordinal", None),
            'indicator_noformat': request.form.get("indicator_noformat", None),
            'indicator_order': request.form.get("indicator_order", None),
            'indicator_weight': request.form.get("indicator_weight", None)
        }
        indicator = dqindicators.addIndicator(data)
        if indicator:
            flash('Successfully added Indicator.', 'success')
        else:
            flash("Couldn't add Indicator. Maybe one already exists with the same name?", 'error')
    else:
        indicator = None
    return render_template("indicator_edit.html", 
                         indicatorgroups=indicatorgroups, 
                         indicator=indicator,
                         admin=usermanagement.check_perms('admin'),
                         loggedinuser=current_user)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:28,代码来源:indicators.py


示例10: indicators_edit

def indicators_edit(indicatorgroup=None, indicator=None):
    indicatorgroups = dqindicators.indicatorGroups()
    if (request.method == 'POST'):
        data = {
            'name': request.form['name'],
            'description': request.form['description'],
            'indicatorgroup_id': request.form['indicatorgroup_id'],
            'longdescription': request.form['longdescription'],
            'indicator_type': request.form.get("indicator_type"),
            'indicator_category_name': request.form.get("indicator_category_name"),
            'indicator_subcategory_name': request.form.get("indicator_subcategory_name"),
            'indicator_ordinal': request.form.get("indicator_ordinal", None),
            'indicator_noformat': request.form.get("indicator_noformat", None),
            'indicator_order': request.form.get("indicator_order", None),
            'indicator_weight': request.form.get("indicator_weight", None)
        }
        indicator = dqindicators.updateIndicator(indicatorgroup, indicator, data)
        flash('Successfully updated Indicator', 'success')
    else:
        indicator = dqindicators.indicators(indicatorgroup, indicator)
    return render_template("indicator_edit.html", 
                         indicatorgroups=indicatorgroups, 
                         indicator=indicator,
                         admin=usermanagement.check_perms('admin'),
                         loggedinuser=current_user)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:25,代码来源:indicators.py


示例11: organisation_survey_view

def organisation_survey_view(organisation_code, workflow, workflow_name, organisationsurvey, allowed_to_edit):
    organisation = Organisation.query.filter_by(
        organisation_code=organisation_code).first_or_404()

    surveydata = dqsurveys.getSurveyData(organisation_code, workflow_name)
    surveydata_allworkflows = dqsurveys.getSurveyDataAllWorkflows(organisation_code)

    indicators = dqindicators.indicators("pwyf2013")
    org_indicators = dqorganisations._organisation_indicators_split(
        organisation, 2)
        
    twentytwelvedata=get_organisation_results(organisation_code, indicators)
    publishedstatuses = dqsurveys.publishedStatus()
    publishedstatuses = dict(map(lambda ps: (ps.id, ps), publishedstatuses))
    publishedformats = dqsurveys.publishedFormat()
    publishedformats = dict(map(lambda pf: (pf.id, pf), publishedformats))

    template_path = "surveys/_survey_"+workflow.WorkflowType.name+".html"
    return render_template(
        template_path, 
        organisation=organisation,
        indicators=indicators,
        org_indicators = org_indicators,
        twentytwelvedata=twentytwelvedata,
        old_publication_status=old_publication_status,
        publishedstatuses=publishedstatuses,
        workflow=workflow,
        surveydata=surveydata_allworkflows,
        organisationsurvey=organisationsurvey,
        allowed_to_edit=allowed_to_edit,
        publishedformats=publishedformats,
        admin=usermanagement.check_perms('admin'),
        loggedinuser=current_user)
开发者ID:mk270,项目名称:IATI-Data-Quality,代码行数:33,代码来源:surveys.py


示例12: organisation_edit

def organisation_edit(organisation_code=None):
    packages = dqpackages.packages()
    packagegroups = dqpackages.packageGroups()
    organisation = dqorganisations.organisations(organisation_code)

    if request.method == 'POST':
        if 'addpackages' in request.form:
            add_packages(organisation)
        elif 'addpackagegroup' in request.form:
            add_packagegroup(organisation)
        elif 'updateorganisation' in request.form:
            update_organisation(organisation_code)

    organisationpackages = dqorganisations.organisationPackages(
        organisation.organisation_code)

    return render_template(
        "organisation_edit.html", 
        organisation=organisation, 
        packages=packages, 
        packagegroups=packagegroups,
        donorresponses=donorresponse.RESPONSE_TYPES,
        organisationpackages=organisationpackages,
        admin=usermanagement.check_perms('admin'),
        loggedinuser=current_user)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:25,代码来源:organisations.py


示例13: indicators

def indicators(indicatorgroup=None):
    indicators = dqindicators.indicators(indicatorgroup)
    indicatorgroup = dqindicators.indicatorGroups(indicatorgroup)
    return render_template("indicators.html", 
                        indicatorgroup=indicatorgroup, 
                        indicators=indicators,
                        admin=usermanagement.check_perms('admin'),
                        loggedinuser=current_user)
开发者ID:shreyabasu,项目名称:IATI-Data-Quality,代码行数:8,代码来源:indicators.py


示例14: users

def users(username=None):
    if username:
        return redirect(url_for('users_edit', username=username))
    else:
        users=dqusers.user()
        return render_template("users.html", users=users,
             admin=usermanagement.check_perms('admin'),
             loggedinuser=current_user)
开发者ID:mk270,项目名称:IATI-Data-Quality,代码行数:8,代码来源:users.py


示例15: publishers

def publishers():
    p_groups = PackageGroup.query.order_by(
        PackageGroup.name).all()

    pkgs = Package.query.order_by(Package.package_name).all()
    return render_template("packagegroups.html", p_groups=p_groups, 
             pkgs=pkgs,
             admin=usermanagement.check_perms('admin'),
             loggedinuser=current_user)
开发者ID:shreyabasu,项目名称:IATI-Data-Quality,代码行数:9,代码来源:publishers.py


示例16: surveys_admin

def surveys_admin():
    surveys = dqsurveys.surveys()
    workflows = dqsurveys.workflowsAll()
    publishedstatuses=dqsurveys.publishedStatus()
    admin = usermanagement.check_perms('admin')
    loggedinuser = current_user

    return render_template("surveys/surveys_admin.html", 
                           **locals())
开发者ID:shreyabasu,项目名称:IATI-Data-Quality,代码行数:9,代码来源:surveys.py


示例17: surveys_admin

def surveys_admin():
    surveys = dqsurveys.surveys()
    workflows = dqsurveys.workflows()
    publishedstatuses=dqsurveys.publishedStatus()
    return render_template("surveys/surveys_admin.html", 
                           workflows=workflows,
                           publishedstatuses=publishedstatuses,
                           surveys=surveys,
                           admin=usermanagement.check_perms('admin'),
                           loggedinuser=current_user)
开发者ID:mk270,项目名称:IATI-Data-Quality,代码行数:10,代码来源:surveys.py


示例18: organisation_conditions

def organisation_conditions(id=None):
    if id is not None:
        pc = dqpublishercondition.get_publisher_condition(id)
        return render_template("organisation_condition.html", pc=pc,
             admin=usermanagement.check_perms('admin'),
             loggedinuser=current_user)
    else:
        pcs = dqpublishercondition.get_publisher_conditions()
        feedbackconditions = dqpublishercondition.get_publisher_feedback()
        text = ""
        for i, condition in enumerate(feedbackconditions):
            if i>0: text += "\n"
            text += condition.Organisation.organisation_code + " does not use "
            text += condition.OrganisationConditionFeedback.element + " at "
            text += condition.OrganisationConditionFeedback.where
        return render_template("organisation_conditions.html", pcs=pcs,
             admin=usermanagement.check_perms('admin'),
             loggedinuser=current_user,
             feedbackconditions=text)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:19,代码来源:publisher_conditions.py


示例19: import_organisation_conditions

def import_organisation_conditions(step=None):
    # Step=1: form; submit to step2
    #
    if step == "2":
        return ipc_step2()
    elif step == "3":
        return ipc_step3()
    else:
        return render_template(
            "import_organisation_conditions.html", admin=usermanagement.check_perms("admin"), loggedinuser=current_user
        )
开发者ID:shreyabasu,项目名称:IATI-Data-Quality,代码行数:11,代码来源:publisher_conditions.py


示例20: indicatorgroups_edit

def indicatorgroups_edit(indicatorgroup=None):
    if (request.method == 'POST'):
        data = {
            'name': request.form['name'],
            'description': request.form['description']
        }
        indicatorgroup = dqindicators.updateIndicatorGroup(indicatorgroup, data)
        flash('Successfully updated IndicatorGroup', 'success')
    else:
        indicatorgroup = dqindicators.indicatorGroups(indicatorgroup)
    return render_template("indicatorgroups_edit.html", indicatorgroup=indicatorgroup,
                 admin=usermanagement.check_perms('admin'),
                 loggedinuser=current_user)
开发者ID:andylolz,项目名称:IATI-Data-Quality,代码行数:13,代码来源:indicators.py



注:本文中的usermanagement.check_perms函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.RequestValidator类代码示例发布时间:2022-05-27
下一篇:
Python userinterface.Client类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap