Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env-devel
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ WEBSERVER_GARBAGE_COLLECTOR=null
WEBSERVER_GROUPS=1
WEBSERVER_GUNICORN_CMD_ARGS=--timeout=180
WEBSERVER_HOST=webserver
WEBSERVER_LICENSES=true
WEBSERVER_LOGIN={}
WEBSERVER_LOGLEVEL=INFO
WEBSERVER_META_MODELING=1
Expand Down
6 changes: 4 additions & 2 deletions api/specs/web-server/_licensed_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
from models_library.generics import Envelope
from models_library.rest_error import EnvelopedError
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP
from simcore_service_webserver.licenses._models import (
from simcore_service_webserver.licenses._common.exceptions_handlers import (
_TO_HTTP_ERROR_MAP,
)
from simcore_service_webserver.licenses._common.models import (
LicensedItemsBodyParams,
LicensedItemsListQueryParams,
LicensedItemsPathParams,
Expand Down
4 changes: 3 additions & 1 deletion api/specs/web-server/_licensed_items_checkouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
from models_library.rest_error import EnvelopedError
from models_library.rest_pagination import Page
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP
from simcore_service_webserver.licenses._common.exceptions_handlers import (
_TO_HTTP_ERROR_MAP,
)
from simcore_service_webserver.licenses._licensed_items_checkouts_models import (
LicensedItemCheckoutPathParams,
LicensedItemsCheckoutsListQueryParams,
Expand Down
6 changes: 4 additions & 2 deletions api/specs/web-server/_licensed_items_purchases.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
from models_library.rest_error import EnvelopedError
from models_library.rest_pagination import Page
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP
from simcore_service_webserver.licenses._models import (
from simcore_service_webserver.licenses._common.exceptions_handlers import (
_TO_HTTP_ERROR_MAP,
)
from simcore_service_webserver.licenses._common.models import (
LicensedItemsPurchasesListQueryParams,
LicensedItemsPurchasesPathParams,
)
Expand Down
4 changes: 4 additions & 0 deletions services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ services:
INVITATIONS_SECRET_KEY: ${INVITATIONS_SECRET_KEY}
INVITATIONS_USERNAME: ${INVITATIONS_USERNAME}

WEBSERVER_LICENSES: ${WEBSERVER_LICENSES}

WEBSERVER_LOGIN: ${WEBSERVER_LOGIN}
LOGIN_ACCOUNT_DELETION_RETENTION_DAYS: ${LOGIN_ACCOUNT_DELETION_RETENTION_DAYS}
LOGIN_REGISTRATION_CONFIRMATION_REQUIRED: ${LOGIN_REGISTRATION_CONFIRMATION_REQUIRED}
Expand Down Expand Up @@ -897,6 +899,7 @@ services:
WEBSERVER_GARBAGE_COLLECTOR: ${WB_DB_EL_GARBAGE_COLLECTOR}
WEBSERVER_GROUPS: ${WB_DB_EL_GROUPS}
WEBSERVER_INVITATIONS: ${WB_DB_EL_INVITATIONS}
WEBSERVER_LICENSES: 0
WEBSERVER_LOGIN: ${WB_DB_EL_LOGIN}
WEBSERVER_PAYMENTS: ${WB_DB_EL_PAYMENTS}
WEBSERVER_META_MODELING: ${WB_DB_EL_META_MODELING}
Expand Down Expand Up @@ -1000,6 +1003,7 @@ services:
WEBSERVER_FRONTEND: ${WB_GC_FRONTEND}
WEBSERVER_GROUPS: ${WB_GC_GROUPS}
WEBSERVER_INVITATIONS: ${WB_GC_INVITATIONS}
WEBSERVER_LICENSES: 0
WEBSERVER_LOGIN: ${WB_GC_LOGIN}
WEBSERVER_META_MODELING: ${WB_GC_META_MODELING}
WEBSERVER_NOTIFICATIONS: ${WB_GC_NOTIFICATIONS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
WEBSERVER_DB_LISTENER: bool = True
WEBSERVER_FOLDERS: bool = True
WEBSERVER_GROUPS: bool = True
WEBSERVER_LICENSES: bool = True
WEBSERVER_LICENSES: bool = False
WEBSERVER_META_MODELING: bool = True
WEBSERVER_NOTIFICATIONS: bool = Field(default=True)
WEBSERVER_PRODUCTS: bool = True
Expand Down Expand Up @@ -384,6 +384,7 @@ def _get_disabled_public_plugins(self) -> list[str]:
public_plugin_candidates: Final = {
"WEBSERVER_EXPORTER",
"WEBSERVER_FOLDERS",
"WEBSERVER_LICENSES",
"WEBSERVER_META_MODELING",
"WEBSERVER_PAYMENTS",
"WEBSERVER_SCICRUNCH",
Expand Down Expand Up @@ -451,16 +452,17 @@ def to_client_statics(self) -> dict[str, Any]:
"SIMCORE_VCS_RELEASE_TAG": True,
"SIMCORE_VCS_RELEASE_URL": True,
"SWARM_STACK_NAME": True,
"WEBSERVER_LICENSES": True,
"WEBSERVER_LOGIN": {
"LOGIN_ACCOUNT_DELETION_RETENTION_DAYS",
"LOGIN_2FA_REQUIRED",
},
"WEBSERVER_PROJECTS": {
"PROJECTS_MAX_NUM_RUNNING_DYNAMIC_NODES",
},
"WEBSERVER_TRASH": {
"TRASH_RETENTION_DAYS",
},
"WEBSERVER_LOGIN": {
"LOGIN_ACCOUNT_DELETION_RETENTION_DAYS",
"LOGIN_2FA_REQUIRED",
},
"WEBSERVER_SESSION": {"SESSION_COOKIE_MAX_AGE"},
},
exclude_none=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from servicelib.aiohttp import status
from simcore_service_webserver.wallets.errors import WalletAccessForbiddenError

from ..exception_handling import (
from ...exception_handling import (
ExceptionToHttpErrorMap,
HttpErrorInfo,
exception_handling_decorator,
to_exceptions_handlers_map,
)
from ..wallets.errors import WalletNotEnoughCreditsError
from .errors import LicensedItemNotFoundError, LicensedItemPricingPlanMatchError
from ...wallets.errors import WalletNotEnoughCreditsError
from ..errors import LicensedItemNotFoundError, LicensedItemPricingPlanMatchError

_logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from pydantic import BaseModel, ConfigDict, Field
from servicelib.request_keys import RQT_USERID_KEY

from .._constants import RQ_PRODUCT_KEY
from ..._constants import RQ_PRODUCT_KEY

_logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
from ..utils_aiohttp import envelope_json_response
from ..wallets._handlers import WalletsPathParams
from . import _licensed_items_checkouts_service
from ._exceptions_handlers import handle_plugin_requests_exceptions
from ._common.exceptions_handlers import handle_plugin_requests_exceptions
from ._common.models import LicensedItemsRequestContext
from ._licensed_items_checkouts_models import (
LicensedItemCheckoutGet,
LicensedItemCheckoutGetPage,
LicensedItemCheckoutPathParams,
LicensedItemsCheckoutsListQueryParams,
)
from ._models import LicensedItemsRequestContext

_logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from ..utils_aiohttp import envelope_json_response
from ..wallets._handlers import WalletsPathParams
from . import _licensed_items_purchases_service
from ._exceptions_handlers import handle_plugin_requests_exceptions
from ._models import (
from ._common.exceptions_handlers import handle_plugin_requests_exceptions
from ._common.models import (
LicensedItemsPurchasesListQueryParams,
LicensedItemsPurchasesPathParams,
LicensedItemsRequestContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from ..security.decorators import permission_required
from ..utils_aiohttp import envelope_json_response
from . import _licensed_items_service
from ._exceptions_handlers import handle_plugin_requests_exceptions
from ._models import (
from ._common.exceptions_handlers import handle_plugin_requests_exceptions
from ._common.models import (
LicensedItemsBodyParams,
LicensedItemsListQueryParams,
LicensedItemsPathParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from ..wallets.api import get_wallet_with_available_credits_by_user_and_wallet
from ..wallets.errors import WalletNotEnoughCreditsError
from . import _licensed_items_repository
from ._models import LicensedItemsBodyParams
from ._common.models import LicensedItemsBodyParams
from .errors import LicensedItemPricingPlanMatchError

_logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from servicelib.aiohttp.application_setup import ModuleCategory, app_module_setup

from ..rabbitmq import setup_rabbitmq
from ..rest.plugin import setup_rest
from . import (
_licensed_items_checkouts_rest,
_licensed_items_purchases_rest,
Expand All @@ -22,13 +23,13 @@
__name__,
ModuleCategory.ADDON,
settings_name="WEBSERVER_LICENSES",
depends=["simcore_service_webserver.rest"],
logger=_logger,
)
def setup_licenses(app: web.Application):
assert app[APP_SETTINGS_KEY].WEBSERVER_LICENSES # nosec

# routes
setup_rest(app)
app.router.add_routes(_licensed_items_rest.routes)
app.router.add_routes(_licensed_items_purchases_rest.routes)
app.router.add_routes(_licensed_items_checkouts_rest.routes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def test_settings_to_client_statics_plugins(

assert settings.WEBSERVER_LOGIN

assert statics["webserverLicenses"] == settings.WEBSERVER_LICENSES

assert (
statics["webserverLogin"]["LOGIN_ACCOUNT_DELETION_RETENTION_DAYS"]
== settings.WEBSERVER_LOGIN.LOGIN_ACCOUNT_DELETION_RETENTION_DAYS
Expand Down
Loading