vantage6-algorithm-store 4.3.2__tar.gz → 4.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/PKG-INFO +1 -1
  2. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/_version.py +1 -1
  3. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/default_roles.py +2 -2
  4. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/vantage6_server.py +13 -1
  5. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/__init__.py +6 -3
  6. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/schema/output_schema.py +7 -0
  7. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6_algorithm_store.egg-info/PKG-INFO +1 -1
  8. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6_algorithm_store.egg-info/requires.txt +2 -2
  9. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/setup.cfg +0 -0
  10. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/setup.py +0 -0
  11. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/__build__ +0 -0
  12. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/__init__.py +0 -0
  13. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/db.py +0 -0
  14. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/globals.py +0 -0
  15. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/__init__.py +0 -0
  16. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/algorithm.py +0 -0
  17. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/argument.py +0 -0
  18. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/base.py +0 -0
  19. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/common/enums.py +0 -0
  20. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/database.py +0 -0
  21. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/developer_algorithm_association.py +0 -0
  22. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/function.py +0 -0
  23. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/permission.py +0 -0
  24. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/review.py +0 -0
  25. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/role.py +0 -0
  26. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/role_rule_association.py +0 -0
  27. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/rule.py +0 -0
  28. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/model/user.py +0 -0
  29. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/permission.py +0 -0
  30. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/algorithm.py +0 -0
  31. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/role.py +0 -0
  32. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/rule.py +0 -0
  33. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/schema/input_schema.py +0 -0
  34. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/user.py +0 -0
  35. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/vantage6_server.py +0 -0
  36. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/resource/version.py +0 -0
  37. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6/algorithm/store/wsgi.py +0 -0
  38. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6_algorithm_store.egg-info/SOURCES.txt +0 -0
  39. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6_algorithm_store.egg-info/dependency_links.txt +0 -0
  40. {vantage6-algorithm-store-4.3.2 → vantage6-algorithm-store-4.3.4}/vantage6_algorithm_store.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vantage6-algorithm-store
3
- Version: 4.3.2
3
+ Version: 4.3.4
4
4
  Summary: Vantage6 algorithm store
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
@@ -7,7 +7,7 @@ with open(os.path.join(here, "__build__")) as fp:
7
7
  __build__ = json.load(fp)
8
8
 
9
9
  # Module version
10
- version_info = (4, 3, 2, "final", __build__, 0)
10
+ version_info = (4, 3, 4, "final", __build__, 0)
11
11
 
12
12
  # Module version stage suffix map
13
13
  _specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
@@ -54,7 +54,7 @@ def get_default_roles() -> list[dict]:
54
54
  ]
55
55
  REVIEWER_ROLE = {
56
56
  "name": DefaultRole.REVIEWER,
57
- "description": "Can view, edit and delete algorithms, and create and edit users",
57
+ "description": "Can view, edit and delete algorithms",
58
58
  "rules": REVIEWER_RULES,
59
59
  }
60
60
  # 4. Store manager role
@@ -67,7 +67,7 @@ def get_default_roles() -> list[dict]:
67
67
  ]
68
68
  STORE_MANAGER = {
69
69
  "name": DefaultRole.STORE_MANAGER,
70
- "description": "Can view and delete algorithms.",
70
+ "description": "Can manage algorithms, and create and edit users.",
71
71
  "rules": STORE_MANAGER,
72
72
  }
73
73
  # 4. Developer role
@@ -38,5 +38,17 @@ class Vantage6Server(Base):
38
38
  Vanatge6Server | None
39
39
  Vanatge6Server object if found, None otherwise
40
40
  """
41
+
42
+ def _get_by_url(url):
43
+ return session.query(Vantage6Server).filter_by(url=url).first()
44
+
41
45
  session = DatabaseSessionManager.get_session()
42
- return session.query(Vantage6Server).filter_by(url=url).first()
46
+ server = _get_by_url(url)
47
+ if not server:
48
+ if url.startswith("https") and url.endswith("443"):
49
+ url = url[:-4]
50
+ server = _get_by_url(url)
51
+ elif url.startswith("http") and url.endswith("80"):
52
+ url = url[:-3]
53
+ server = _get_by_url(url)
54
+ return server
@@ -59,14 +59,17 @@ def authenticate_with_server(*args, **kwargs):
59
59
  return {"msg": msg}, HTTPStatus.BAD_REQUEST
60
60
 
61
61
  # check if server is whitelisted
62
- server = Vantage6Server.get_by_url(request.headers["Server-Url"])
62
+ server_url = request.headers["Server-Url"]
63
+ server = Vantage6Server.get_by_url(server_url)
63
64
  if not server:
64
- msg = "Server you are trying to authenticate with is not " "whitelisted"
65
+ msg = (
66
+ f"Server '{server_url}' you are trying to authenticate with is not "
67
+ "whitelisted"
68
+ )
65
69
  log.warning(msg)
66
70
  return {"msg": msg}, HTTPStatus.UNAUTHORIZED
67
71
 
68
72
  # check if token is valid
69
-
70
73
  url = f"{request.headers['Server-Url']}/token/user/validate"
71
74
  # if we are looking for a localhost server, we probably have to
72
75
  # check host.docker.internal (Windows) or 172.17.0.1 (Linux)
@@ -111,6 +111,12 @@ class Vantage6ServerOutputSchema(HATEOASModelSchema):
111
111
  class Meta:
112
112
  model = Vantage6Server
113
113
 
114
+ users = fields.Function(
115
+ lambda obj: create_one_to_many_link(
116
+ obj, link_to="user", link_from="v6_server_id"
117
+ )
118
+ )
119
+
114
120
 
115
121
  class RoleOutputSchema(HATEOASModelSchema):
116
122
  rules = fields.Function(
@@ -139,6 +145,7 @@ class UserOutputSchema(HATEOASModelSchema):
139
145
  obj, link_to="algorithm", link_from="user_id"
140
146
  )
141
147
  )
148
+ server = fields.Nested("Vantage6ServerOutputSchema", exclude=["users"])
142
149
 
143
150
 
144
151
  class ReviewOutputSchema(HATEOASModelSchema):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vantage6-algorithm-store
3
- Version: 4.3.2
3
+ Version: 4.3.4
4
4
  Summary: Vantage6 algorithm store
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
@@ -10,8 +10,8 @@ requests==2.31.0
10
10
  schema==0.7.5
11
11
  SQLAlchemy==1.4.46
12
12
  werkzeug==3.0.1
13
- vantage6==4.3.2
14
- vantage6-common==4.3.2
13
+ vantage6==4.3.4
14
+ vantage6-common==4.3.4
15
15
 
16
16
  [dev]
17
17
  coverage==6.4.4