mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
* install django-grainy * nsp to grainy first iteration * nsp to grainy second iteration * grainy and django-grainy pinned to latest releases * Fix typo * Update djangorestframework, peeringdb, django-ratelimit * Rewrite login view ratelimit decorator * Relock pipfile * add list() to make copy of dictionaries before iterating * relock pipfile with python3.9 change docker to use python3.9 * add ordering to admin search queryset for deskproticket and email * add org api key and begin to write tests * additional key tests * add drf-api-keys to pipfile * Wire orgapikey to modelviewsetpermissions * Update api key helper functions * add put test * Add Org API key tab to frontend * Add user api key model * Update user key handling and tests * Update APIPermissionsApplicator to make it work w requests * Add org api key perm panel * add org key permissions * Add user api key views * Add templates for handling user api key (adding, not revoking) * relock pipfile * assorted fixes and tweaks * Add general user group permissions and org user group perms * refactor org api key perms * Add tests for api keys * Add docstrings to permissions helpers * Add api key examples * squash migrations * remove custom api key header config * Change api key test setup * Update permissions for grainy change * Bump up pipfile and pipfile.lock * Add API Key to Verification Queue Item * Delete travis * Add workaround to Dockerfile * update pipfile and sort out migrations * Add comment to Dockerfile * Re-add API Key migrations * Add locale to .gitignore * remove suggest functionality from ix * Update test to recognize that IX api no longer has suggest function * Add test to outlaw POSTing an IX w its org equal to the suggest entity org * Add meta information geowarning * Add alert to demonstrate UI * Add error to fac update * Add template warning for geovalidation * Add geowarning meta js * cover absent meta_response test case * Update styles for geowarning * refactor geotag warning implementation * null lat and long on unsuccessful geo locate * modify geovalidation frontend update * Add deskproticket model email field * Add missing span * add email to org keys * Add email to org key tests * update serializer with rdap validation wrapper * update admin for api keys * Enable writing an email as part of org key creation * Add email validation to org api key form * fix css style on perm row * Add suggested info to api response * display suggested address on frontend * add needs geocode to serializer * save lat long on forward geonormalization * add address suggestion submit button * Add suggested address popin to ADD facility form * Fix css * add lat and long rounding to geocodenabled model clean method * add migration and regression test for lat long decimal db constraint * Add another regression test for model decimal places * Get deskpro functions passing isort and flake * Update ticket_queue_deletion_prevented * update ticket_queue_deletion_prevented for use with org api key * add template for org key dpt from asnauto skipvq * Update deskproticket for rdap error * add facility aka * add aka to serializer and views * black and isort test api keys * fix typo in org key deskpro template * skip or rewrite unapplicable org key tests, and add as_set tests * adjust api key test comments * Add vqi_notify to signals * Add reversion comments for api keys and helper function * update how org keys are added to verification queue items * rename verification queue item fk from api_key to org_key * fix group id error * update key tests with correct http header info * check both user and key, not just user * templates fiex * adapt deskpro integration to work with email only * make org api keys editable for desc and email * pipfile relock * edit test setupdata settings for groups * Change comment to signify we don't need to remove code * address untranslated accept button * Add docstrings to the serializer functions * Add loading shim * Add migration for all longname and aka * Add aka and long name to views and serializers * delete migration w decimals * standardize serializer lat and long fields * Add clean rounding for lat and long * fix serializer error * api key admin improvements * fix linebreak in user api key form * remove debug prints * Add rounding util * Add rounding to lat and long fields * remove 'clean' from geocode method (logic now in admin form) * remove erroneous tests * revert serializer changes * Fix migrations * Add long name and aka to admin models * Update API key docs * Add documentation for api keys * fix typo * fix org api key revoke broken by editable api keys * doc tweaks * doc tweaks * doc tweaks * black format * fix migration hierarchy * docs * docs * api key permissions screenshot * formatting * formatting * padding fixed * remove one image * fix get_user_from_request type checking take out POST only valdiator for entity suggest * didnt mean to commit the django-peeringdb mount * fix suggest on PUT net fix tests * black formatting * update org key permission template * install rust for cryptography * pipfile relock (django-peeringdb to 2.6) Co-authored-by: Stefan Pratter <stefan@20c.com> Co-authored-by: Elliot Frank <elliot@20c.com>
298 lines
9.6 KiB
Python
298 lines
9.6 KiB
Python
from django.conf.urls import include, url
|
|
from django.views.generic import TemplateView, RedirectView
|
|
from django.conf import settings
|
|
|
|
import peeringdb_server.rest
|
|
|
|
from peeringdb_server.models import InternetExchange, Network, Facility, Organization
|
|
|
|
from peeringdb_server.autocomplete_views import (
|
|
FacilityAutocompleteForNetwork,
|
|
FacilityAutocompleteForExchange,
|
|
OrganizationAutocomplete,
|
|
ExchangeAutocomplete,
|
|
ExchangeAutocompleteJSON,
|
|
IXLanAutocomplete,
|
|
FacilityAutocomplete,
|
|
FacilityAutocompleteJSON,
|
|
DeletedVersionAutocomplete,
|
|
clt_history,
|
|
)
|
|
|
|
from peeringdb_server.export_views import (
|
|
view_export_ixf_ix_members,
|
|
view_export_ixf_ixlan_members,
|
|
AdvancedSearchExportView,
|
|
)
|
|
|
|
from peeringdb_server.import_views import (
|
|
view_import_ixlan_ixf_preview,
|
|
view_import_net_ixf_postmortem,
|
|
view_import_net_ixf_preview,
|
|
)
|
|
|
|
from django.views.i18n import JavaScriptCatalog
|
|
|
|
# o
|
|
# SITE
|
|
|
|
from peeringdb_server.views import (
|
|
view_index,
|
|
view_registration,
|
|
view_password_reset,
|
|
view_password_change,
|
|
view_set_user_locale,
|
|
view_network,
|
|
view_network_by_asn,
|
|
view_network_by_query,
|
|
view_suggest,
|
|
view_exchange,
|
|
view_facility,
|
|
view_organization,
|
|
view_affiliate_to_org,
|
|
view_request_ownership,
|
|
view_verify,
|
|
view_profile,
|
|
view_profile_v1,
|
|
view_advanced_search,
|
|
view_sponsorships,
|
|
view_partnerships,
|
|
view_aup,
|
|
view_about,
|
|
view_username_retrieve,
|
|
view_username_retrieve_initiate,
|
|
view_username_retrieve_complete,
|
|
view_maintenance,
|
|
resend_confirmation_mail,
|
|
request_logout,
|
|
request_api_search,
|
|
request_search,
|
|
request_translation,
|
|
cancel_affiliation_request,
|
|
network_dismiss_ixf_proposal,
|
|
network_reset_ixf_proposals,
|
|
)
|
|
import peeringdb_server.org_admin_views
|
|
import peeringdb_server.api_key_views
|
|
import peeringdb_server.data_views
|
|
|
|
urlpatterns = [
|
|
url(r"^api_search$", request_api_search),
|
|
url(r"^search$", request_search),
|
|
url(r"^advanced_search", view_advanced_search),
|
|
url(r"^logout$", request_logout),
|
|
url(
|
|
r"^login$",
|
|
RedirectView.as_view(pattern_name="two_factor:login", permanent=True),
|
|
),
|
|
url(r"^register$", view_registration),
|
|
url(r"^reset-password$", view_password_reset),
|
|
url(r"^change-password$", view_password_change),
|
|
url(r"^set-user-locale$", view_set_user_locale),
|
|
url(r"^username-retrieve/initiate$", view_username_retrieve_initiate),
|
|
url(r"^username-retrieve/complete$", view_username_retrieve_complete),
|
|
url(r"^username-retrieve$", view_username_retrieve),
|
|
url(r"^verify$", view_verify),
|
|
url(r"^profile$", view_profile, name="user-profile"),
|
|
url(r"^profile/v1$", view_profile_v1),
|
|
url(r"^resend_email_confirmation$", resend_confirmation_mail),
|
|
url(r"^sponsors$", view_sponsorships),
|
|
# url(r'^partners$', view_partnerships),
|
|
url(r"^aup$", view_aup),
|
|
url(r"^about$", view_about),
|
|
url(r"^affiliate-to-org$", view_affiliate_to_org),
|
|
url(
|
|
r"^cancel-affiliation-request/(?P<uoar_id>\d+)/$",
|
|
cancel_affiliation_request,
|
|
name="cancel-affiliation-request",
|
|
),
|
|
url(r"^request-ownership$", view_request_ownership),
|
|
url(
|
|
r"^%s/(?P<net_id>\d+)/dismiss-ixf-proposal/(?P<ixf_id>\d+)/$"
|
|
% Network.handleref.tag,
|
|
network_dismiss_ixf_proposal,
|
|
name="net-dismiss-ixf-proposal",
|
|
),
|
|
url(
|
|
r"^%s/(?P<net_id>\d+)/reset-ixf-proposals/$" % Network.handleref.tag,
|
|
network_reset_ixf_proposals,
|
|
name="net-reset-ixf-proposals",
|
|
),
|
|
url(r"^%s/(?P<id>\d+)/?$" % Network.handleref.tag, view_network, name="net-view"),
|
|
url(
|
|
r"^%s/(?P<id>\d+)/?$" % InternetExchange.handleref.tag,
|
|
view_exchange,
|
|
name="ix-view",
|
|
),
|
|
url(r"^%s/(?P<id>\d+)/?$" % Facility.handleref.tag, view_facility, name="fac-view"),
|
|
url(
|
|
r"^%s/(?P<id>\d+)/?$" % Organization.handleref.tag,
|
|
view_organization,
|
|
name="org-view",
|
|
),
|
|
url(r"^%s$" % Network.handleref.tag, view_network_by_query),
|
|
url(r"^asn/(?P<asn>\d+)/?$", view_network_by_asn, name="net-view-asn"),
|
|
url(r"^user_keys/add$", peeringdb_server.api_key_views.add_user_key),
|
|
url(r"^user_keys/revoke$", peeringdb_server.api_key_views.remove_user_key),
|
|
url(r"^org_admin/users$", peeringdb_server.org_admin_views.users),
|
|
url(
|
|
r"^org_admin/user_permissions$",
|
|
peeringdb_server.org_admin_views.user_permissions,
|
|
),
|
|
url(
|
|
r"^org_admin/user_permissions/update$",
|
|
peeringdb_server.org_admin_views.user_permission_update,
|
|
),
|
|
url(
|
|
r"^org_admin/user_permissions/remove$",
|
|
peeringdb_server.org_admin_views.user_permission_remove,
|
|
),
|
|
url(r"^org_admin/permissions$", peeringdb_server.org_admin_views.permissions),
|
|
url(r"^org_admin/uoar/approve$", peeringdb_server.org_admin_views.uoar_approve),
|
|
url(r"^org_admin/uoar/deny$", peeringdb_server.org_admin_views.uoar_deny),
|
|
url(
|
|
r"^org_admin/manage_user/update$",
|
|
peeringdb_server.org_admin_views.manage_user_update,
|
|
),
|
|
url(
|
|
r"^org_admin/manage_user/delete$",
|
|
peeringdb_server.org_admin_views.manage_user_delete,
|
|
),
|
|
url(r"^org_admin/manage_key/add$", peeringdb_server.api_key_views.manage_key_add),
|
|
url(
|
|
r"^org_admin/manage_key/update$",
|
|
peeringdb_server.api_key_views.manage_key_update,
|
|
),
|
|
url(
|
|
r"^org_admin/manage_key/revoke$",
|
|
peeringdb_server.api_key_views.manage_key_revoke,
|
|
),
|
|
url(
|
|
r"^org_admin/key_permissions$",
|
|
peeringdb_server.api_key_views.key_permissions,
|
|
),
|
|
url(
|
|
r"^org_admin/key_permissions/update$",
|
|
peeringdb_server.api_key_views.key_permission_update,
|
|
),
|
|
url(
|
|
r"^org_admin/key_permissions/remove$",
|
|
peeringdb_server.api_key_views.key_permission_remove,
|
|
),
|
|
url(r"^data/countries$", peeringdb_server.data_views.countries),
|
|
url(r"^data/sponsors$", peeringdb_server.data_views.sponsorships),
|
|
url(r"^data/countries_b$", peeringdb_server.data_views.countries_w_blank),
|
|
url(r"^data/facilities$", peeringdb_server.data_views.facilities),
|
|
url(r"^data/enum/(?P<name>[\w_]+)$", peeringdb_server.data_views.enum),
|
|
url(r"^data/asns$", peeringdb_server.data_views.asns),
|
|
url(r"^data/organizations$", peeringdb_server.data_views.organizations),
|
|
url(r"^data/locales$", peeringdb_server.data_views.languages),
|
|
url(r"^export/ix/(?P<ix_id>\d+)/ixp-member-list$", view_export_ixf_ix_members),
|
|
url(
|
|
r"^export/ixlan/(?P<ixlan_id>\d+)/ixp-member-list$",
|
|
view_export_ixf_ixlan_members,
|
|
),
|
|
url(
|
|
r"^export/advanced-search/(?P<tag>[\w_]+)/(?P<fmt>[\w_-]+)$",
|
|
AdvancedSearchExportView.as_view(),
|
|
),
|
|
url(r"^import/ixlan/(?P<ixlan_id>\d+)/ixf/preview$", view_import_ixlan_ixf_preview),
|
|
url(r"^import/net/(?P<net_id>\d+)/ixf/postmortem$", view_import_net_ixf_postmortem),
|
|
url(r"^import/net/(?P<net_id>\d+)/ixf/preview$", view_import_net_ixf_preview),
|
|
url(r"^$", view_index),
|
|
url(r"^i18n/", include("django.conf.urls.i18n")),
|
|
url("jsi18n/", JavaScriptCatalog.as_view(), name="javascript-catalog"),
|
|
url(r"^(net|ix|fac|org|asn)/translate$", request_translation),
|
|
url(r"^suggest/(?P<reftag>fac)$", view_suggest),
|
|
url(r"^maintenance$", view_maintenance, name="maintenance"),
|
|
]
|
|
|
|
# o
|
|
# REST API
|
|
|
|
urlpatterns += [
|
|
url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")),
|
|
url(
|
|
r"^apidocs/swagger/",
|
|
TemplateView.as_view(
|
|
template_name="apidocs/swagger.html",
|
|
extra_context={"schema_url": "openapi-schema"},
|
|
),
|
|
name="swagger-ui",
|
|
),
|
|
url(
|
|
r"^apidocs/",
|
|
TemplateView.as_view(
|
|
template_name="apidocs/redoc.html",
|
|
extra_context={"schema_url": "openapi-schema"},
|
|
),
|
|
name="redoc-ui",
|
|
),
|
|
url(r"^api/", include(peeringdb_server.rest.urls)),
|
|
]
|
|
|
|
# AUTOCOMPLETE
|
|
|
|
urlpatterns += [
|
|
url(
|
|
r"^autocomplete/fac/net/(?P<net_id>\d+)/$",
|
|
FacilityAutocompleteForNetwork.as_view(),
|
|
name="autocomplete-fac-net",
|
|
),
|
|
url(
|
|
r"^autocomplete/fac/ix/(?P<ix_id>\d+)/$",
|
|
FacilityAutocompleteForExchange.as_view(),
|
|
name="autocomplete-fac-ix",
|
|
),
|
|
url(
|
|
r"^autocomplete/org/$",
|
|
OrganizationAutocomplete.as_view(),
|
|
name="autocomplete-org",
|
|
),
|
|
url(
|
|
r"^autocomplete/ix/json$",
|
|
ExchangeAutocompleteJSON.as_view(),
|
|
name="autocomplete-ix-json",
|
|
),
|
|
url(r"^autocomplete/ix$", ExchangeAutocomplete.as_view(), name="autocomplete-ix"),
|
|
url(
|
|
r"^autocomplete/fac/json$",
|
|
FacilityAutocompleteJSON.as_view(),
|
|
name="autocomplete-fac-json",
|
|
),
|
|
url(r"^autocomplete/fac$", FacilityAutocomplete.as_view(), name="autocomplete-fac"),
|
|
url(
|
|
r"^autocomplete/ixlan/$", IXLanAutocomplete.as_view(), name="autocomplete-ixlan"
|
|
),
|
|
url(
|
|
r"^autocomplete/admin/deletedversions$",
|
|
DeletedVersionAutocomplete.as_view(),
|
|
name="autocomplete-admin-deleted-versions",
|
|
),
|
|
]
|
|
|
|
# Admin autocomplete for commandlinetool history
|
|
|
|
urlpatterns += [
|
|
url(
|
|
fr"^autocomplete/admin/clt-history/{tool_id}/$",
|
|
ToolHistory.as_view(),
|
|
name=f"autocomplete-admin-clt-history-{tool_id}",
|
|
)
|
|
for tool_id, ToolHistory in list(clt_history.items())
|
|
]
|
|
|
|
# Oauth2
|
|
|
|
urlpatterns += [
|
|
url(r"^oauth2/", include("oauth2_provider.urls", namespace="oauth2_provider")),
|
|
]
|
|
|
|
# DEBUG
|
|
if settings.DEBUG:
|
|
import debug_toolbar
|
|
|
|
urlpatterns = [
|
|
url(r"^__debug__/", include(debug_toolbar.urls)),
|
|
] + urlpatterns
|