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"])
|
||||
@login_required
|
||||
def create_edit_token(username, id=None):
|
||||
user = User.query.filter_by(username=username).first()
|
||||
if user is None:
|
||||
abort(404)
|
||||
|
||||
user = User.query.filter_by(username=username).one_or_404()
|
||||
if not user.check_perm(current_user, Permission.CREATE_TOKEN):
|
||||
abort(403)
|
||||
|
||||
|
@ -502,7 +502,7 @@ class Package(db.Model):
|
||||
back_populates="package", cascade="all, delete, delete-orphan")
|
||||
|
||||
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",
|
||||
cascade="all, delete, delete-orphan")
|
||||
|
Loading…
Reference in New Issue
Block a user