2020-07-12 17:34:25 +02:00
|
|
|
# ContentDB
|
2021-01-30 17:59:42 +01:00
|
|
|
# Copyright (C) 2018-21 rubenwardy
|
2018-05-25 18:28:32 +02:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2021-01-30 17:59:42 +01:00
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
2018-05-25 18:28:32 +02:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2021-01-30 17:59:42 +01:00
|
|
|
# GNU Affero General Public License for more details.
|
2018-05-25 18:28:32 +02:00
|
|
|
#
|
2021-01-30 17:59:42 +01:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2018-05-25 18:28:32 +02:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2019-11-16 00:51:42 +01:00
|
|
|
from flask import Blueprint
|
|
|
|
|
2021-05-04 04:15:26 +02:00
|
|
|
from app.models import User, Package, Permission
|
|
|
|
|
2019-11-16 00:51:42 +01:00
|
|
|
bp = Blueprint("packages", __name__)
|
2018-05-25 18:28:32 +02:00
|
|
|
|
2021-05-04 04:15:26 +02:00
|
|
|
|
|
|
|
def get_package_tabs(user: User, package: Package):
|
|
|
|
if package is None or not package.checkPerm(user, Permission.EDIT_PACKAGE):
|
|
|
|
return []
|
|
|
|
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
"id": "edit",
|
|
|
|
"title": "Edit Details",
|
2021-07-24 05:30:14 +02:00
|
|
|
"url": package.getURL("packages.create_edit")
|
2021-05-04 04:15:26 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "releases",
|
|
|
|
"title": "Releases",
|
2021-07-24 05:30:14 +02:00
|
|
|
"url": package.getURL("packages.list_releases")
|
2021-05-04 04:15:26 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "screenshots",
|
|
|
|
"title": "Screenshots",
|
2021-07-24 05:30:14 +02:00
|
|
|
"url": package.getURL("packages.screenshots")
|
2021-05-04 04:15:26 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "maintainers",
|
|
|
|
"title": "Maintainers",
|
2021-07-24 05:30:14 +02:00
|
|
|
"url": package.getURL("packages.edit_maintainers")
|
2021-05-04 04:15:26 +02:00
|
|
|
},
|
2021-07-24 04:56:43 +02:00
|
|
|
{
|
|
|
|
"id": "audit",
|
|
|
|
"title": "Audit Log",
|
|
|
|
"url": package.getURL("packages.audit")
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "share",
|
|
|
|
"title": "Share and Badges",
|
|
|
|
"url": package.getURL("packages.share")
|
|
|
|
},
|
2021-05-04 04:15:26 +02:00
|
|
|
{
|
|
|
|
"id": "remove",
|
|
|
|
"title": "Remove",
|
2021-07-24 05:30:14 +02:00
|
|
|
"url": package.getURL("packages.remove")
|
2021-05-04 04:15:26 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2020-07-09 05:10:09 +02:00
|
|
|
from . import packages, screenshots, releases, reviews
|