-
Notifications
You must be signed in to change notification settings - Fork 30
🐛 Fixes access rights fields in web-api's PATCH services input model #6180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pcrespov
merged 13 commits into
ITISFoundation:master
from
pcrespov:is5964/fixes-access-rights
Aug 13, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9c6724d
updates serviceUPdateV2
pcrespov 568f4a9
updates OAS
pcrespov 1c1689f
doc
pcrespov 06c2380
common
pcrespov e301552
tests
pcrespov 8c65cb8
cleanup examples
pcrespov a88185e
updates tests
pcrespov 03704a2
minor
pcrespov f63802a
@matusdrobuliak66 fixes version
pcrespov b585c2a
services/webserver api version: 0.40.5 → 0.41.0
pcrespov cf2a6b4
fixes assert
pcrespov 54a797a
attr-defined
pcrespov 12bdc73
fixes mypy
pcrespov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
from datetime import datetime | ||
from typing import Any, ClassVar, TypeAlias | ||
|
||
from models_library.rpc_pagination import PageRpc | ||
from pydantic import BaseModel, Extra, Field, HttpUrl, NonNegativeInt | ||
|
||
from ..boot_options import BootOptions | ||
from ..emails import LowerCaseEmailStr | ||
from ..services_access import ServiceAccessRights | ||
from ..services_access import ServiceAccessRights, ServiceGroupAccessRightsV2 | ||
from ..services_authoring import Author | ||
from ..services_enums import ServiceType | ||
from ..services_history import ServiceRelease | ||
|
@@ -108,14 +109,22 @@ class Config: | |
"owner": "[email protected]", | ||
} | ||
|
||
_EXAMPLE_FILEPICKER_V2 = { | ||
**_EXAMPLE_FILEPICKER, | ||
"accessRights": { | ||
"1": {"execute": True, "write": False}, | ||
"4": {"execute": True, "write": True}, | ||
}, | ||
} | ||
|
||
|
||
_EXAMPLE_SLEEPER: dict[str, Any] = { | ||
"name": "sleeper", | ||
"thumbnail": None, | ||
"description": "A service which awaits for time to pass, two times.", | ||
"classifiers": [], | ||
"quality": {}, | ||
"accessRights": {"1": {"execute_access": True, "write_access": False}}, | ||
"accessRights": {"1": {"execute": True, "write": False}}, | ||
"key": "simcore/services/comp/itis/sleeper", | ||
"version": "2.2.1", | ||
"version_display": "2 Xtreme", | ||
|
@@ -204,15 +213,6 @@ class Config: | |
} | ||
|
||
|
||
class ServiceGroupAccessRightsV2(BaseModel): | ||
execute: bool = False | ||
write: bool = False | ||
|
||
class Config: | ||
alias_generator = snake_to_camel | ||
allow_population_by_field_name = True | ||
|
||
|
||
class ServiceGetV2(BaseModel): | ||
key: ServiceKey | ||
version: ServiceVersion | ||
|
@@ -291,10 +291,10 @@ class Config: | |
], | ||
}, | ||
{ | ||
**_EXAMPLE_FILEPICKER, | ||
**_EXAMPLE_FILEPICKER_V2, | ||
"history": [ | ||
{ | ||
"version": _EXAMPLE_FILEPICKER["version"], | ||
"version": _EXAMPLE_FILEPICKER_V2["version"], | ||
"version_display": "Odei Release", | ||
"released": "2025-03-25T00:00:00", | ||
} | ||
|
@@ -310,3 +310,28 @@ class Config: | |
] | ||
|
||
ServiceResourcesGet: TypeAlias = ServiceResourcesDict | ||
|
||
|
||
class ServiceUpdateV2(BaseModel): | ||
name: str | None = None | ||
thumbnail: HttpUrl | None = None | ||
|
||
description: str | None = None | ||
version_display: str | None = None | ||
|
||
deprecated: datetime | None = None | ||
|
||
classifiers: list[str] | None = None | ||
quality: dict[str, Any] = {} | ||
|
||
access_rights: dict[GroupID, ServiceGroupAccessRightsV2] | None = None | ||
|
||
class Config: | ||
extra = Extra.forbid | ||
alias_generator = snake_to_camel | ||
allow_population_by_field_name = True | ||
|
||
|
||
assert set(ServiceUpdateV2.__fields__.keys()) - set( # nosec | ||
ServiceGetV2.__fields__.keys() | ||
) == {"deprecated"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.40.5 | ||
0.41.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.