mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Fix tokens being deleted when package set to None
This commit is contained in:
parent
b3c5824490
commit
80888f0675
@ -59,10 +59,7 @@ def list_tokens(username):
|
|||||||
@bp.route("/users/<username>/tokens/<int:id>/edit/", methods=["GET", "POST"])
|
@bp.route("/users/<username>/tokens/<int:id>/edit/", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def create_edit_token(username, id=None):
|
def create_edit_token(username, id=None):
|
||||||
user = User.query.filter_by(username=username).first()
|
user = User.query.filter_by(username=username).one_or_404()
|
||||||
if user is None:
|
|
||||||
abort(404)
|
|
||||||
|
|
||||||
if not user.check_perm(current_user, Permission.CREATE_TOKEN):
|
if not user.check_perm(current_user, Permission.CREATE_TOKEN):
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ class Package(db.Model):
|
|||||||
back_populates="package", cascade="all, delete, delete-orphan")
|
back_populates="package", cascade="all, delete, delete-orphan")
|
||||||
|
|
||||||
tokens = db.relationship("APIToken", foreign_keys="APIToken.package_id", back_populates="package",
|
tokens = db.relationship("APIToken", foreign_keys="APIToken.package_id", back_populates="package",
|
||||||
cascade="all, delete, delete-orphan")
|
cascade="all, delete")
|
||||||
|
|
||||||
update_config = db.relationship("PackageUpdateConfig", uselist=False, back_populates="package",
|
update_config = db.relationship("PackageUpdateConfig", uselist=False, back_populates="package",
|
||||||
cascade="all, delete, delete-orphan")
|
cascade="all, delete, delete-orphan")
|
||||||
|
Loading…
Reference in New Issue
Block a user