Example #1
0
def rules_history():
    """GET /rules/history"""
    history_table = dbo.rules.history
    rules = _get_histories(history_table, get_rules)
    history = {
        "rules": rules,
        "sc_rules": RuleScheduledChangeHistoryView().get_all()
    }
    histories = {
        "Rules": json.loads(history["rules"].data),
        "Rules scheduled change": json.loads(history["sc_rules"].data)
    }
    return histories
Example #2
0
def rules_history():
    """GET /rules/history"""
    history_table = dbo.rules.history
    rules = _get_histories(history_table, get_rules)
    history = {
        'rules': rules,
        'sc_rules': RuleScheduledChangeHistoryView().get_all()
    }
    histories = {
        'Rules': json.loads(history['rules'].data),
        'Rules scheduled change': json.loads(history['sc_rules'].data)
    }
    return histories
Example #3
0
    else:
        response.headers["Content-Security-Policy"] = \
            app.config.get("CONTENT_SECURITY_POLICY", "default-src 'none'; frame-ancestors 'none'")
    return response


Compress(app)


# Endpoints required for the Balrog 2.0 UI.
# In the Mozilla deployments of Balrog, both the the admin API (these endpoints)
# and the static admin UI are hosted on the same domain. This API wsgi app is
# hosted at "/api", which is stripped away by the web server before we see
# these requests.
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>", view_func=RuleScheduledChangeView.as_view("scheduled_change_rules"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>/revisions", view_func=RuleScheduledChangeHistoryView.as_view("scheduled_change_rules_history"))

app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>", view_func=PermissionScheduledChangeView.as_view("scheduled_change_permissions"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>/revisions",
                 view_func=PermissionScheduledChangeHistoryView.as_view("scheduled_change_permissions_history"))

app.add_url_rule("/scheduled_changes/releases/<int:sc_id>", view_func=ReleaseScheduledChangeView.as_view("scheduled_change_releases"))
app.add_url_rule("/scheduled_changes/releases/<int:sc_id>/revisions",
                 view_func=ReleaseScheduledChangeHistoryView.as_view("scheduled_change_releases_history"))

app.add_url_rule("/scheduled_changes/required_signoffs/product/<int:sc_id>",
                 view_func=ProductRequiredSignoffScheduledChangeView.as_view("scheduled_change_product_rs"))
app.add_url_rule("/scheduled_changes/required_signoffs/product/<int:sc_id>/revisions",
                 view_func=ProductRequiredSignoffScheduledChangeHistoryView.as_view("scheduled_change_product_rs_history"))

app.add_url_rule("/scheduled_changes/required_signoffs/permissions/<int:sc_id>",
Example #4
0
# hosted at "/api", which is stripped away by the web server before we see
# these requests.
app.add_url_rule(
    "/scheduled_changes/rules",
    view_func=RuleScheduledChangesView.as_view("scheduled_changes_rules"))
app.add_url_rule(
    "/scheduled_changes/rules/<int:sc_id>",
    view_func=RuleScheduledChangeView.as_view("scheduled_change_rules"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>/enact",
                 view_func=EnactRuleScheduledChangeView.as_view(
                     "enact_scheduled_change_rules"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>/signoffs",
                 view_func=RuleScheduledChangeSignoffsView.as_view(
                     "scheduled_change_rules_signoffs"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>/revisions",
                 view_func=RuleScheduledChangeHistoryView.as_view(
                     "scheduled_change_rules_history"))
app.add_url_rule("/scheduled_changes/permissions",
                 view_func=PermissionScheduledChangesView.as_view(
                     "scheduled_changes_permissions"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>",
                 view_func=PermissionScheduledChangeView.as_view(
                     "scheduled_change_permissions"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>/enact",
                 view_func=EnactPermissionScheduledChangeView.as_view(
                     "enact_scheduled_change_permissions"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>/signoffs",
                 view_func=PermissionScheduledChangeSignoffsView.as_view(
                     "scheduled_change_permissions_signoffs"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>/revisions",
                 view_func=PermissionScheduledChangeHistoryView.as_view(
                     "scheduled_change_permissions_history"))
Example #5
0
def scheduled_change_rules_history_post(sc_id):
    """POST /scheduled_changes/rules/<int:sc_id>/revisions"""
    return RuleScheduledChangeHistoryView().post(sc_id)
Example #6
0
app.add_url_rule("/releases/<release>/read_only", view_func=ReleaseReadOnlyView.as_view("read_only"))
app.add_url_rule("/releases/<release>/builds/<platform>/<locale>", view_func=SingleLocaleView.as_view("single_locale"))
app.add_url_rule("/releases/<release>/revisions", view_func=ReleaseHistoryView.as_view("release_revisions"))
app.add_url_rule("/releases/columns/<column>", view_func=SingleReleaseColumnView.as_view("release_columns"))
app.add_url_rule("/required_signoffs/product", view_func=ProductRequiredSignoffsView.as_view("product_required_signoffs"))
app.add_url_rule("/required_signoffs/product/revisions", view_func=ProductRequiredSignoffsHistoryAPIView.as_view("product_required_signoffs_revisions"))
app.add_url_rule("/required_signoffs/permissions", view_func=PermissionsRequiredSignoffsView.as_view("permissions_required_signoffs"))
app.add_url_rule("/required_signoffs/permissions/revisions",
                 view_func=PermissionsRequiredSignoffsHistoryAPIView.as_view("permissions_required_signoffs_revisions"))
app.add_url_rule("/history/diff/release/<change_id>/<field>", view_func=ReleaseDiffView.as_view("release_diff"))
app.add_url_rule("/history/view/release/<change_id>/<field>", view_func=ReleaseFieldView.as_view("release_field"))
app.add_url_rule("/scheduled_changes/rules", view_func=RuleScheduledChangesView.as_view("scheduled_changes_rules"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>", view_func=RuleScheduledChangeView.as_view("scheduled_change_rules"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>/enact", view_func=EnactRuleScheduledChangeView.as_view("enact_scheduled_change_rules"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>/signoffs", view_func=RuleScheduledChangeSignoffsView.as_view("scheduled_change_rules_signoffs"))
app.add_url_rule("/scheduled_changes/rules/<int:sc_id>/revisions", view_func=RuleScheduledChangeHistoryView.as_view("scheduled_change_rules_history"))
app.add_url_rule("/scheduled_changes/permissions", view_func=PermissionScheduledChangesView.as_view("scheduled_changes_permissions"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>", view_func=PermissionScheduledChangeView.as_view("scheduled_change_permissions"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>/enact", view_func=EnactPermissionScheduledChangeView.as_view("enact_scheduled_change_permissions"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>/signoffs",
                 view_func=PermissionScheduledChangeSignoffsView.as_view("scheduled_change_permissions_signoffs"))
app.add_url_rule("/scheduled_changes/permissions/<int:sc_id>/revisions",
                 view_func=PermissionScheduledChangeHistoryView.as_view("scheduled_change_permissions_history"))
app.add_url_rule("/scheduled_changes/releases", view_func=ReleaseScheduledChangesView.as_view("scheduled_changes_releases"))
app.add_url_rule("/scheduled_changes/releases/<int:sc_id>", view_func=ReleaseScheduledChangeView.as_view("scheduled_change_releases"))
app.add_url_rule("/scheduled_changes/releases/<int:sc_id>/enact", view_func=EnactReleaseScheduledChangeView.as_view("enact_scheduled_change_releases"))
app.add_url_rule("/scheduled_changes/releases/<int:sc_id>/signoffs", view_func=ReleaseScheduledChangeSignoffsView.as_view("scheduled_change_release_signoffs"))
app.add_url_rule("/scheduled_changes/releases/<int:sc_id>/revisions",
                 view_func=ReleaseScheduledChangeHistoryView.as_view("scheduled_change_releases_history"))
app.add_url_rule("/scheduled_changes/required_signoffs/product", view_func=ProductRequiredSignoffsScheduledChangesView.as_view("scheduled_changes_product_rs"))
app.add_url_rule("/scheduled_changes/required_signoffs/product/<int:sc_id>",