mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-04-01 06:03:39 +00:00
type: use ClassVar decorator for class attributes
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#
|
||||
import aiohttp_jinja2
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -35,7 +35,7 @@ class DocsView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Unauthorized
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Unauthorized
|
||||
ROUTES = ["/api-docs"]
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#
|
||||
from aiohttp.web import Response, json_response
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.utils import partition
|
||||
@@ -35,7 +36,7 @@ class SwaggerView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Unauthorized
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Unauthorized
|
||||
ROUTES = ["/api-docs/swagger.json"]
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNotFound, Request, StreamResponse, View
|
||||
from aiohttp_cors import CorsViewMixin # type: ignore[import-untyped]
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import TypeVar
|
||||
from typing import ClassVar, TypeVar
|
||||
|
||||
from ahriman.core.auth import Auth
|
||||
from ahriman.core.configuration import Configuration
|
||||
@@ -46,8 +46,8 @@ class BaseView(View, CorsViewMixin):
|
||||
ROUTES(list[str]): (class attribute) list of supported routes
|
||||
"""
|
||||
|
||||
OPTIONS_PERMISSION = UserAccess.Unauthorized
|
||||
ROUTES: list[str] = []
|
||||
OPTIONS_PERMISSION: ClassVar[UserAccess] = UserAccess.Unauthorized
|
||||
ROUTES: ClassVar[list[str]] = []
|
||||
|
||||
@property
|
||||
def configuration(self) -> Configuration:
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#
|
||||
import aiohttp_jinja2
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from ahriman.core.auth.helpers import authorized_userid
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -48,7 +48,7 @@ class IndexView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Unauthorized
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Unauthorized
|
||||
ROUTES = ["/", "/index.html"]
|
||||
|
||||
@aiohttp_jinja2.template("build-status.jinja2")
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPFound, HTTPNotFound
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.views.base import BaseView
|
||||
@@ -31,7 +32,7 @@ class StaticView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Unauthorized
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Unauthorized
|
||||
ROUTES = ["/favicon.ico"]
|
||||
|
||||
async def get(self) -> None:
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
|
||||
|
||||
@@ -25,7 +27,7 @@ class StatusViewGuard:
|
||||
helper for check if status routes are enabled
|
||||
"""
|
||||
|
||||
ROUTES: list[str]
|
||||
ROUTES: ClassVar[list[str]]
|
||||
|
||||
@classmethod
|
||||
def routes(cls, configuration: Configuration) -> list[str]:
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.event import Event
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -35,7 +36,7 @@ class EventsView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION = POST_PERMISSION = UserAccess.Full # type: ClassVar[UserAccess]
|
||||
ROUTES = ["/api/v1/events"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.models.worker import Worker
|
||||
@@ -37,7 +38,7 @@ class WorkersView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
DELETE_PERMISSION = GET_PERMISSION = POST_PERMISSION = UserAccess.Full
|
||||
DELETE_PERMISSION = GET_PERMISSION = POST_PERMISSION = UserAccess.Full # type: ClassVar[UserAccess]
|
||||
ROUTES = ["/api/v1/distributed"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.changes import Changes
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -36,8 +37,8 @@ class ChangesView(StatusViewGuard, BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/packages/{package}/changes"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.dependencies import Dependencies
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -36,8 +37,8 @@ class DependenciesView(StatusViewGuard, BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/packages/{package}/dependencies"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.exceptions import UnknownPackageError
|
||||
from ahriman.core.utils import pretty_datetime
|
||||
@@ -39,8 +40,8 @@ class LogsView(StatusViewGuard, BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
DELETE_PERMISSION = POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
DELETE_PERMISSION = POST_PERMISSION = UserAccess.Full # type: ClassVar[UserAccess]
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
ROUTES = ["/api/v1/packages/{package}/logs"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.exceptions import UnknownPackageError
|
||||
from ahriman.models.build_status import BuildStatusEnum
|
||||
@@ -40,8 +41,8 @@ class PackageView(StatusViewGuard, BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
DELETE_PERMISSION = POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION = UserAccess.Read
|
||||
DELETE_PERMISSION = POST_PERMISSION = UserAccess.Full # type: ClassVar[UserAccess]
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Read
|
||||
ROUTES = ["/api/v1/packages/{package}"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -21,6 +21,7 @@ import itertools
|
||||
|
||||
from aiohttp.web import HTTPNoContent, Response, json_response
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.build_status import BuildStatus
|
||||
from ahriman.models.package import Package
|
||||
@@ -40,8 +41,8 @@ class PackagesView(StatusViewGuard, BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Read
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Read
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/packages"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPNoContent, HTTPNotFound, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -35,8 +36,8 @@ class PatchView(StatusViewGuard, BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
DELETE_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
DELETE_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
ROUTES = ["/api/v1/packages/{package}/patches/{patch}"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.pkgbuild_patch import PkgbuildPatch
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -36,8 +37,8 @@ class PatchesView(StatusViewGuard, BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/packages/{package}/patches"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.pkgbuild_patch import PkgbuildPatch
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -34,7 +35,7 @@ class AddView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/service/add"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -33,7 +34,7 @@ class LogsView(BaseView):
|
||||
DELETE_PERMISSION(UserAccess): (class attribute) delete permissions of self
|
||||
"""
|
||||
|
||||
DELETE_PERMISSION = UserAccess.Full
|
||||
DELETE_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/service/logs"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNotFound, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -34,8 +35,8 @@ class PGPView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/service/pgp"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPNotFound, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -33,7 +34,7 @@ class ProcessView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
ROUTES = ["/api/v1/service/process/{process_id}"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -33,7 +34,7 @@ class RebuildView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/service/rebuild"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -33,7 +34,7 @@ class RemoveView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/service/remove"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.pkgbuild_patch import PkgbuildPatch
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -34,7 +35,7 @@ class RequestView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
POST_PERMISSION = UserAccess.Reporter
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
ROUTES = ["/api/v1/service/request"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNotFound, Response, json_response
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.alpm.remote import AUR
|
||||
from ahriman.models.aur_package import AURPackage
|
||||
@@ -36,7 +37,7 @@ class SearchView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
ROUTES = ["/api/v1/service/search"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -33,7 +34,7 @@ class UpdateView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/service/update"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -23,6 +23,7 @@ from aiohttp import BodyPartReader
|
||||
from aiohttp.web import HTTPBadRequest, HTTPCreated
|
||||
from pathlib import Path
|
||||
from tempfile import NamedTemporaryFile
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.models.repository_paths import RepositoryPaths
|
||||
@@ -40,7 +41,7 @@ class UploadView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/service/upload"]
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -34,7 +35,7 @@ class InfoView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Unauthorized
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Unauthorized
|
||||
ROUTES = ["/api/v1/info"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -33,7 +34,7 @@ class RepositoriesView(BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Read
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Read
|
||||
ROUTES = ["/api/v1/repositories"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.models.build_status import BuildStatusEnum
|
||||
@@ -40,8 +41,8 @@ class StatusView(StatusViewGuard, BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Read
|
||||
POST_PERMISSION = UserAccess.Full
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Read
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Full
|
||||
ROUTES = ["/api/v1/status"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPFound, HTTPMethodNotAllowed, HTTPUnauthorized
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.auth.helpers import remember
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -35,7 +36,7 @@ class LoginView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = POST_PERMISSION = UserAccess.Unauthorized
|
||||
GET_PERMISSION = POST_PERMISSION = UserAccess.Unauthorized # type: ClassVar[UserAccess]
|
||||
ROUTES = ["/api/v1/login"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPFound, HTTPUnauthorized
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.core.auth.helpers import check_authorized, forget
|
||||
from ahriman.models.user_access import UserAccess
|
||||
@@ -33,7 +34,7 @@ class LogoutView(BaseView):
|
||||
POST_PERMISSION(UserAccess): (class attribute) post permissions of self
|
||||
"""
|
||||
|
||||
POST_PERMISSION = UserAccess.Unauthorized
|
||||
POST_PERMISSION: ClassVar[UserAccess] = UserAccess.Unauthorized
|
||||
ROUTES = ["/api/v1/logout"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import Response, json_response
|
||||
from typing import ClassVar
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec.decorators import apidocs
|
||||
@@ -34,7 +35,7 @@ class LogsView(StatusViewGuard, BaseView):
|
||||
GET_PERMISSION(UserAccess): (class attribute) get permissions of self
|
||||
"""
|
||||
|
||||
GET_PERMISSION = UserAccess.Reporter
|
||||
GET_PERMISSION: ClassVar[UserAccess] = UserAccess.Reporter
|
||||
ROUTES = ["/api/v2/packages/{package}/logs"]
|
||||
|
||||
@apidocs(
|
||||
|
||||
Reference in New Issue
Block a user