mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
* fix next redirect when using U2F 2FA auth (#1191) * Added self identifier to API * fix migrations hierarchy after merging in previous support branch * campus object Co-authored-by: Stefan Pratter <stefan@20c.com> * fix out of bound error message add city / country to campus view * fix tests * relock poetry * linting * linting * fix docs regen * regen docs * linting * refactor self entity view to support carrier and campus object types and also make it easier to support additional object types in the future * remove debug message --------- Co-authored-by: Gajanan Patil <dipaksavaliya.python@gmail.com>
174 lines
6.3 KiB
Python
174 lines
6.3 KiB
Python
# Generated by Django 2.2.17 on 2021-01-04 11:18
|
|
|
|
import django.db.models.deletion
|
|
import django_grainy.fields
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("peeringdb_server", "0063_populate_last_update_fields"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="OrganizationAPIKey",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.CharField(
|
|
editable=False,
|
|
max_length=100,
|
|
primary_key=True,
|
|
serialize=False,
|
|
unique=True,
|
|
),
|
|
),
|
|
("prefix", models.CharField(editable=False, max_length=8, unique=True)),
|
|
("hashed_key", models.CharField(editable=False, max_length=100)),
|
|
("created", models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
default=None,
|
|
help_text="A free-form name for the API key. Need not be unique. 50 characters max.",
|
|
max_length=50,
|
|
),
|
|
),
|
|
(
|
|
"revoked",
|
|
models.BooleanField(
|
|
blank=True,
|
|
default=False,
|
|
help_text="If the API key is revoked, clients cannot use it anymore. (This cannot be undone.)",
|
|
),
|
|
),
|
|
(
|
|
"expiry_date",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Once API key expires, clients cannot use it anymore.",
|
|
null=True,
|
|
verbose_name="Expires",
|
|
),
|
|
),
|
|
(
|
|
"org",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="api_keys",
|
|
to="peeringdb_server.Organization",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Organization API key",
|
|
"verbose_name_plural": "Organization API keys",
|
|
"db_table": "peeringdb_org_api_key",
|
|
"ordering": ("-created",),
|
|
"abstract": False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="UserAPIKey",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.CharField(
|
|
editable=False,
|
|
max_length=100,
|
|
primary_key=True,
|
|
serialize=False,
|
|
unique=True,
|
|
),
|
|
),
|
|
("prefix", models.CharField(editable=False, max_length=8, unique=True)),
|
|
("hashed_key", models.CharField(editable=False, max_length=100)),
|
|
("created", models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
default=None,
|
|
help_text="A free-form name for the API key. Need not be unique. 50 characters max.",
|
|
max_length=50,
|
|
),
|
|
),
|
|
(
|
|
"revoked",
|
|
models.BooleanField(
|
|
blank=True,
|
|
default=False,
|
|
help_text="If the API key is revoked, clients cannot use it anymore. (This cannot be undone.)",
|
|
),
|
|
),
|
|
(
|
|
"expiry_date",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Once API key expires, clients cannot use it anymore.",
|
|
null=True,
|
|
verbose_name="Expires",
|
|
),
|
|
),
|
|
(
|
|
"readonly",
|
|
models.BooleanField(
|
|
default=False,
|
|
help_text="Determines if API Key inherits the User Permissions or is readonly.",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="api_keys",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "User API key",
|
|
"verbose_name_plural": "User API keys",
|
|
"db_table": "peeringdb_user_api_key",
|
|
"ordering": ("-created",),
|
|
"abstract": False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="OrganizationAPIPermission",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.AutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"namespace",
|
|
models.CharField(
|
|
help_text="Permission namespace (A '.' delimited list of keys",
|
|
max_length=255,
|
|
),
|
|
),
|
|
("permission", django_grainy.fields.PermissionField(default=1)),
|
|
(
|
|
"org_api_key",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="grainy_permissions",
|
|
to="peeringdb_server.OrganizationAPIKey",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Organization API key Permission",
|
|
"verbose_name_plural": "Organization API key Permission",
|
|
"base_manager_name": "objects",
|
|
},
|
|
),
|
|
]
|