c2cgeoportal-commons 2.7.1.156__py3-none-any.whl → 2.8.1.180__py3-none-any.whl

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.

Potentially problematic release.


This version of c2cgeoportal-commons might be problematic. Click here for more details.

Files changed (62) hide show
  1. c2cgeoportal_commons/alembic/env.py +6 -7
  2. c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +2 -2
  3. c2cgeoportal_commons/alembic/main/04f05bfbb05e_remove_the_old_is_expanded_column.py +1 -1
  4. c2cgeoportal_commons/alembic/main/116b9b79fc4d_internal_and_external_layer_tables_.py +34 -38
  5. c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +1 -5
  6. c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +1 -1
  7. c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +3 -3
  8. c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +2 -2
  9. c2cgeoportal_commons/alembic/main/20137477bd02_update_icons_url.py +1 -1
  10. c2cgeoportal_commons/alembic/main/21f11066f8ec_trigger_on_role_updates_user_in_static.py +13 -15
  11. c2cgeoportal_commons/alembic/main/22e6dfb556de_add_description_tree_.py +1 -1
  12. c2cgeoportal_commons/alembic/main/29f2a32859ec_merge_1_6_and_master_branches.py +1 -5
  13. c2cgeoportal_commons/alembic/main/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py +1 -1
  14. c2cgeoportal_commons/alembic/main/32527659d57b_move_exclude_properties_from_layerv1_to_.py +7 -7
  15. c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +1 -5
  16. c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +15 -17
  17. c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +30 -30
  18. c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +70 -0
  19. c2cgeoportal_commons/alembic/main/5109242131ce_add_column_time_widget.py +1 -1
  20. c2cgeoportal_commons/alembic/main/53ba1a68d5fe_add_theme_to_fulltextsearch.py +1 -1
  21. c2cgeoportal_commons/alembic/main/54645a535ad6_add_ordering_in_relation.py +9 -9
  22. c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +5 -9
  23. c2cgeoportal_commons/alembic/main/6a412d9437b1_rename_serverogc_to_ogcserver.py +3 -3
  24. c2cgeoportal_commons/alembic/main/7530011a66a7_trigger_on_role_updates_user_in_static.py +13 -15
  25. c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +20 -44
  26. c2cgeoportal_commons/alembic/main/7d271f4527cd_add_layer_column_in_layerv1_table.py +1 -1
  27. c2cgeoportal_commons/alembic/main/809650bd04c3_add_dimension_field.py +1 -1
  28. c2cgeoportal_commons/alembic/main/8117bb9bba16_use_dimension_on_all_the_layers.py +3 -3
  29. c2cgeoportal_commons/alembic/main/9268a1dffac0_add_trigger_to_be_able_to_correctly_.py +1 -1
  30. c2cgeoportal_commons/alembic/main/94db7e7e5b21_merge_2_2_and_master_branches.py +1 -5
  31. c2cgeoportal_commons/alembic/main/951ff84bd8ec_be_able_to_delete_a_wms_layer_in_sql.py +1 -1
  32. c2cgeoportal_commons/alembic/main/a4f1aac9bda_merge_1_6_and_master_branches.py +1 -5
  33. c2cgeoportal_commons/alembic/main/b60f2a505f42_remame_uimetadata_to_metadata.py +1 -1
  34. c2cgeoportal_commons/alembic/main/d48a63b348f1_change_mapserver_url_for_docker.py +5 -9
  35. c2cgeoportal_commons/alembic/main/d8ef99bc227e_be_able_to_delete_a_linked_functionality.py +1 -1
  36. c2cgeoportal_commons/alembic/main/daf738d5bae4_merge_2_0_and_master_branches.py +1 -5
  37. c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +1 -5
  38. c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +5 -21
  39. c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +5 -9
  40. c2cgeoportal_commons/alembic/main/ec82a8906649_add_missing_on_delete_cascade_on_layer_.py +1 -1
  41. c2cgeoportal_commons/alembic/main/ee25d267bf46_main_interface_desktop.py +3 -9
  42. c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +1 -5
  43. c2cgeoportal_commons/alembic/static/1857owc78a07_add_last_login_and_expiration_date.py +1 -1
  44. c2cgeoportal_commons/alembic/static/1da396a88908_move_user_table_to_static_schema.py +4 -8
  45. c2cgeoportal_commons/alembic/static/3f89a7d71a5e_alter_column_url_to_remove_limitation.py +1 -1
  46. c2cgeoportal_commons/alembic/static/44c91d82d419_add_table_log.py +70 -0
  47. c2cgeoportal_commons/alembic/static/53d671b17b20_add_timezone_on_datetime_fields.py +1 -1
  48. c2cgeoportal_commons/alembic/static/5472fbc19f39_add_temp_password_column.py +1 -1
  49. c2cgeoportal_commons/alembic/static/76d72fb3fcb9_add_oauth2_pkce.py +68 -0
  50. c2cgeoportal_commons/alembic/static/7ef947f30f20_add_oauth2_tables.py +1 -1
  51. c2cgeoportal_commons/alembic/static/ae5e88f35669_add_table_user_role.py +7 -13
  52. c2cgeoportal_commons/lib/url.py +1 -1
  53. c2cgeoportal_commons/lib/validators.py +1 -3
  54. c2cgeoportal_commons/models/__init__.py +2 -2
  55. c2cgeoportal_commons/models/main.py +101 -7
  56. c2cgeoportal_commons/models/sqlalchemy.py +7 -8
  57. c2cgeoportal_commons/models/static.py +44 -2
  58. c2cgeoportal_commons/testing/__init__.py +3 -2
  59. {c2cgeoportal_commons-2.7.1.156.dist-info → c2cgeoportal_commons-2.8.1.180.dist-info}/METADATA +8 -4
  60. {c2cgeoportal_commons-2.7.1.156.dist-info → c2cgeoportal_commons-2.8.1.180.dist-info}/RECORD +62 -59
  61. {c2cgeoportal_commons-2.7.1.156.dist-info → c2cgeoportal_commons-2.8.1.180.dist-info}/WHEEL +0 -0
  62. {c2cgeoportal_commons-2.7.1.156.dist-info → c2cgeoportal_commons-2.8.1.180.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,70 @@
1
+ # Copyright (c) 2023-2023, Camptocamp SA
2
+ # All rights reserved.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+
7
+ # 1. Redistributions of source code must retain the above copyright notice, this
8
+ # list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ # The views and conclusions contained in the software and documentation are those
25
+ # of the authors and should not be interpreted as representing official policies,
26
+ # either expressed or implied, of the FreeBSD Project.
27
+
28
+ """
29
+ Add table log.
30
+
31
+ Revision ID: 44c91d82d419
32
+ Revises: 7ef947f30f20
33
+ Create Date: 2023-01-14 10:58:44.404643
34
+ """
35
+
36
+ import sqlalchemy as sa
37
+ from alembic import op
38
+ from c2c.template.config import config
39
+
40
+ # revision identifiers, used by Alembic.
41
+ revision = "44c91d82d419"
42
+ down_revision = "7ef947f30f20"
43
+ branch_labels = None
44
+ depends_on = None
45
+
46
+
47
+ def upgrade() -> None:
48
+ """Upgrade."""
49
+ staticschema = config["schema_static"]
50
+
51
+ op.create_table(
52
+ "log",
53
+ sa.Column("id", sa.Integer(), nullable=False),
54
+ sa.Column("date", sa.DateTime(timezone=True), nullable=False),
55
+ sa.Column("action", sa.Unicode, nullable=False),
56
+ sa.Column("element_type", sa.String(length=50), nullable=False),
57
+ sa.Column("element_id", sa.Integer(), nullable=False),
58
+ sa.Column("element_name", sa.Unicode(), nullable=False),
59
+ sa.Column("element_url_table", sa.Unicode(), nullable=False),
60
+ sa.Column("username", sa.Unicode(), nullable=False),
61
+ sa.PrimaryKeyConstraint("id"),
62
+ schema=staticschema,
63
+ )
64
+
65
+
66
+ def downgrade() -> None:
67
+ """Downgrade."""
68
+ staticschema = config["schema_static"]
69
+
70
+ op.drop_table("log", schema=staticschema)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -0,0 +1,68 @@
1
+ # Copyright (c) 2023, Camptocamp SA
2
+ # All rights reserved.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+
7
+ # 1. Redistributions of source code must retain the above copyright notice, this
8
+ # list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ # The views and conclusions contained in the software and documentation are those
25
+ # of the authors and should not be interpreted as representing official policies,
26
+ # either expressed or implied, of the FreeBSD Project.
27
+
28
+ """
29
+ Add Oauth2 - PKCE.
30
+
31
+ Revision ID: 76d72fb3fcb9
32
+ Revises: 44c91d82d419
33
+ Create Date: 2023-02-07 17:32:22.835450
34
+ """
35
+
36
+ from alembic import op
37
+ from c2c.template.config import config
38
+ from sqlalchemy import Boolean, Column, String
39
+
40
+ # revision identifiers, used by Alembic.
41
+ revision = "76d72fb3fcb9"
42
+ down_revision = "44c91d82d419"
43
+ branch_labels = None
44
+ depends_on = None
45
+
46
+
47
+ def upgrade() -> None:
48
+ """Upgrade."""
49
+ staticschema = config["schema_static"]
50
+
51
+ op.add_column("oauth2_client", Column("state_required", Boolean), schema=staticschema)
52
+ op.add_column("oauth2_client", Column("pkce_required", Boolean), schema=staticschema)
53
+ op.add_column("oauth2_bearertoken", Column("state", String), schema=staticschema)
54
+ op.add_column("oauth2_authorizationcode", Column("state", String), schema=staticschema)
55
+ op.add_column("oauth2_authorizationcode", Column("challenge", String(128)), schema=staticschema)
56
+ op.add_column("oauth2_authorizationcode", Column("challenge_method", String(6)), schema=staticschema)
57
+
58
+
59
+ def downgrade() -> None:
60
+ """Downgrade."""
61
+ staticschema = config["schema_static"]
62
+
63
+ op.drop_column("oauth2_client", "state_required", schema=staticschema)
64
+ op.drop_column("oauth2_client", "pkce_required", schema=staticschema)
65
+ op.drop_column("oauth2_bearertoken", "state", schema=staticschema)
66
+ op.drop_column("oauth2_authorizationcode", "state", schema=staticschema)
67
+ op.drop_column("oauth2_authorizationcode", "challenge", schema=staticschema)
68
+ op.drop_column("oauth2_authorizationcode", "challenge_method", schema=staticschema)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020, Camptocamp SA
1
+ # Copyright (c) 2020-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -59,24 +59,20 @@ def upgrade() -> None:
59
59
  schema=staticschema,
60
60
  )
61
61
  op.execute(
62
- """
62
+ f"""
63
63
  INSERT INTO "{staticschema}"."user_role" ("user_id", "role_id")
64
64
  SELECT "user"."id", "role"."id"
65
65
  FROM "{staticschema}"."user"
66
- JOIN "{schema}"."role" ON "role"."name" = "user"."role_name";""".format(
67
- schema=schema, staticschema=staticschema
68
- )
66
+ JOIN "{schema}"."role" ON "role"."name" = "user"."role_name";"""
69
67
  )
70
68
 
71
69
  op.add_column("user", Column("settings_role_id", Integer), schema=staticschema)
72
70
  op.execute(
73
- """
71
+ f"""
74
72
  UPDATE "{staticschema}"."user"
75
73
  SET "settings_role_id" = "role"."id"
76
74
  FROM "{schema}"."role"
77
- WHERE "role"."name" = "user"."role_name";""".format(
78
- schema=schema, staticschema=staticschema
79
- )
75
+ WHERE "role"."name" = "user"."role_name";"""
80
76
  )
81
77
 
82
78
  op.drop_column("user", "role_name", schema=staticschema)
@@ -90,13 +86,11 @@ def downgrade() -> None:
90
86
  op.add_column("user", Column("role_name", Unicode), schema=staticschema)
91
87
 
92
88
  op.execute(
93
- """
89
+ f"""
94
90
  UPDATE "{staticschema}"."user"
95
91
  SET "role_name" = "role"."name"
96
92
  FROM "{schema}"."role"
97
- WHERE "role"."id" = "user"."settings_role_id";""".format(
98
- schema=schema, staticschema=staticschema
99
- )
93
+ WHERE "role"."id" = "user"."settings_role_id";"""
100
94
  )
101
95
 
102
96
  op.drop_column("user", "settings_role_id", schema=staticschema)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013-2021, Camptocamp SA
1
+ # Copyright (c) 2013-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2019-2020, Camptocamp SA
1
+ # Copyright (c) 2019-2023, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2011-2021, Camptocamp SA
1
+ # Copyright (c) 2011-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ except ModuleNotFoundError:
41
41
  pass
42
42
 
43
43
 
44
- # Should be filed on application initialisation
44
+ # Should be filed on application initialization
45
45
  DBSession: sqlalchemy.orm.Session = None
46
46
  Base: sqlalchemy.ext.declarative.ConcreteBase = sqlalchemy.ext.declarative.declarative_base()
47
47
  DBSessions: Dict[str, sqlalchemy.orm.Session] = {}
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2011-2021, Camptocamp SA
1
+ # Copyright (c) 2011-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,7 @@
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
28
 
29
+ import enum
29
30
  import logging
30
31
  import os
31
32
  import re
@@ -38,9 +39,10 @@ from geoalchemy2 import Geometry
38
39
  from geoalchemy2.shape import to_shape
39
40
  from papyrus.geo_interface import GeoInterface
40
41
  from sqlalchemy import Column, ForeignKey, Table, UniqueConstraint, event
42
+ from sqlalchemy.ext.declarative import AbstractConcreteBase
41
43
  from sqlalchemy.orm import Session, backref, relationship
42
44
  from sqlalchemy.schema import Index
43
- from sqlalchemy.types import Boolean, Enum, Integer, String, Unicode
45
+ from sqlalchemy.types import Boolean, DateTime, Enum, Integer, String, Unicode
44
46
 
45
47
  from c2cgeoportal_commons.lib.literal import Literal
46
48
  from c2cgeoportal_commons.lib.url import get_url2
@@ -860,11 +862,6 @@ class OGCServer(Base): # type: ignore
860
862
  return url.url() if url else "\n".join(errors)
861
863
 
862
864
 
863
- event.listen(OGCServer, "after_insert", cache_invalidate_cb, propagate=True)
864
- event.listen(OGCServer, "after_update", cache_invalidate_cb, propagate=True)
865
- event.listen(OGCServer, "after_delete", cache_invalidate_cb, propagate=True)
866
-
867
-
868
865
  class LayerWMS(DimensionLayer):
869
866
  """The layer_wms table representation."""
870
867
 
@@ -1748,3 +1745,100 @@ class Dimension(Base): # type: ignore
1748
1745
 
1749
1746
  def __str__(self) -> str:
1750
1747
  return f"{self.name}={self.value}[{self.id}]"
1748
+
1749
+
1750
+ class LogAction(enum.Enum):
1751
+ """The log action enumeration."""
1752
+
1753
+ INSERT = enum.auto()
1754
+ UPDATE = enum.auto()
1755
+ DELETE = enum.auto()
1756
+ SYNCHRONIZE = enum.auto()
1757
+ CONVERT_TO_WMTS = enum.auto()
1758
+ CONVERT_TO_WMS = enum.auto()
1759
+
1760
+
1761
+ class AbstractLog(AbstractConcreteBase, Base): # type: ignore
1762
+ """The abstract log table representation."""
1763
+
1764
+ strict_attrs = True
1765
+ __colanderalchemy_config__ = {
1766
+ "title": _("Log"),
1767
+ "plural": _("Logs"),
1768
+ }
1769
+
1770
+ id = Column(Integer, primary_key=True, info={"colanderalchemy": {}})
1771
+ date = Column(
1772
+ DateTime(timezone=True),
1773
+ nullable=False,
1774
+ info={
1775
+ "colanderalchemy": {
1776
+ "title": _("Date"),
1777
+ }
1778
+ },
1779
+ )
1780
+ action = Column(
1781
+ Enum(LogAction, native_enum=False),
1782
+ nullable=False,
1783
+ info={
1784
+ "colanderalchemy": {
1785
+ "title": _("Action"),
1786
+ }
1787
+ },
1788
+ )
1789
+ element_type = Column(
1790
+ String(50),
1791
+ nullable=False,
1792
+ info={
1793
+ "colanderalchemy": {
1794
+ "title": _("Element type"),
1795
+ }
1796
+ },
1797
+ )
1798
+ element_id = Column(
1799
+ Integer,
1800
+ nullable=False,
1801
+ info={
1802
+ "colanderalchemy": {
1803
+ "title": _("Element identifier"),
1804
+ }
1805
+ },
1806
+ )
1807
+ element_name = Column(
1808
+ Unicode,
1809
+ nullable=False,
1810
+ info={
1811
+ "colanderalchemy": {
1812
+ "title": _("Element name"),
1813
+ }
1814
+ },
1815
+ )
1816
+ element_url_table = Column(
1817
+ Unicode,
1818
+ nullable=False,
1819
+ info={
1820
+ "colanderalchemy": {
1821
+ "title": _("Table segment of the element URL"),
1822
+ }
1823
+ },
1824
+ )
1825
+ username = Column(
1826
+ Unicode,
1827
+ nullable=False,
1828
+ info={
1829
+ "colanderalchemy": {
1830
+ "title": _("Username"),
1831
+ }
1832
+ },
1833
+ )
1834
+
1835
+
1836
+ class Log(AbstractLog):
1837
+ """The main log table representation."""
1838
+
1839
+ __tablename__ = "log"
1840
+ __table_args__ = {"schema": _schema}
1841
+ __mapper_args__ = {
1842
+ "polymorphic_identity": "main",
1843
+ "concrete": True,
1844
+ }
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012-2021, Camptocamp SA
1
+ # Copyright (c) 2012-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -38,20 +38,17 @@ class JSONEncodedDict(TypeDecorator): # type: ignore
38
38
 
39
39
  impl = VARCHAR
40
40
 
41
- @staticmethod
42
- def process_bind_param(value: Optional[Dict[str, Any]], _: Dialect) -> Optional[str]:
41
+ def process_bind_param(self, value: Optional[Dict[str, Any]], _: Dialect) -> Optional[str]:
43
42
  return json.dumps(value) if value is not None else None
44
43
 
45
- @staticmethod
46
- def process_result_value(value: Optional[str], _: Dialect) -> Optional[Dict[str, Any]]:
44
+ def process_result_value(self, value: Optional[str], _: Dialect) -> Optional[Dict[str, Any]]:
47
45
  return json.loads(value) if value is not None else None
48
46
 
49
47
  @property
50
48
  def python_type(self) -> Type[Any]:
51
49
  return dict
52
50
 
53
- @staticmethod
54
- def process_literal_param(value: str, dialect: Any) -> str:
51
+ def process_literal_param(self, value: str, dialect: Any) -> str:
55
52
  del dialect
56
53
  return json.dumps(value)
57
54
 
@@ -59,7 +56,9 @@ class JSONEncodedDict(TypeDecorator): # type: ignore
59
56
  class TsVector(UserDefinedType): # type: ignore
60
57
  """A custom type for PostgreSQL's tsvector type."""
61
58
 
62
- def get_col_spec(self) -> str: # pylint: disable=no-self-use
59
+ cache_ok = True
60
+
61
+ def get_col_spec(self) -> str:
63
62
  return "TSVECTOR"
64
63
 
65
64
  @property
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2011-2021, Camptocamp SA
1
+ # Copyright (c) 2011-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,7 @@ from sqlalchemy.types import Boolean, DateTime, Integer, String, Unicode
44
44
 
45
45
  from c2cgeoportal_commons.lib.literal import Literal
46
46
  from c2cgeoportal_commons.models import Base, _
47
- from c2cgeoportal_commons.models.main import Role
47
+ from c2cgeoportal_commons.models.main import AbstractLog, Role
48
48
 
49
49
  try:
50
50
  from c2cgeoform.ext.deform_ext import RelationSelect2Widget
@@ -386,6 +386,33 @@ class OAuth2Client(Base): # type: ignore
386
386
  }
387
387
  },
388
388
  )
389
+ state_required = Column(
390
+ Boolean,
391
+ default=False,
392
+ info={
393
+ "colanderalchemy": {
394
+ "title": _("State required"),
395
+ "description": _(
396
+ "The state is required for this client (see: "
397
+ "https://auth0.com/docs/secure/attack-protection/state-parameters)."
398
+ ),
399
+ }
400
+ },
401
+ )
402
+ pkce_required = Column(
403
+ Boolean,
404
+ default=False,
405
+ info={
406
+ "colanderalchemy": {
407
+ "title": _("PKCE required"),
408
+ "description": _(
409
+ "PKCE is required for this client (see: "
410
+ "https://auth0.com/docs/get-started/authentication-and-authorization-flow/"
411
+ "authorization-code-flow-with-proof-key-for-code-exchange-pkce)."
412
+ ),
413
+ }
414
+ },
415
+ )
389
416
 
390
417
 
391
418
  class OAuth2BearerToken(Base): # type: ignore
@@ -406,6 +433,7 @@ class OAuth2BearerToken(Base): # type: ignore
406
433
  access_token = Column(Unicode(100), unique=True)
407
434
  refresh_token = Column(Unicode(100), unique=True)
408
435
  expire_at = Column(DateTime(timezone=True)) # in one hour
436
+ state = Column(String)
409
437
 
410
438
 
411
439
  class OAuth2AuthorizationCode(Base): # type: ignore
@@ -425,4 +453,18 @@ class OAuth2AuthorizationCode(Base): # type: ignore
425
453
  user = relationship(User)
426
454
  redirect_uri = Column(Unicode)
427
455
  code = Column(Unicode(100), unique=True)
456
+ state = Column(String)
457
+ challenge = Column(String(128))
458
+ challenge_method = Column(String(6))
428
459
  expire_at = Column(DateTime(timezone=True)) # in 10 minutes
460
+
461
+
462
+ class Log(AbstractLog):
463
+ """The static log table representation."""
464
+
465
+ __tablename__ = "log"
466
+ __table_args__ = {"schema": _schema}
467
+ __mapper_args__ = {
468
+ "polymorphic_identity": "static",
469
+ "concrete": True,
470
+ }
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018-2021, Camptocamp SA
1
+ # Copyright (c) 2018-2023, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -77,7 +77,8 @@ def generate_mappers() -> None:
77
77
 
78
78
  # import or define all models here to ensure they are attached to the
79
79
  # Base.metadata prior to any initialization routines
80
- import c2cgeoportal_commons.models.main # noqa: ignore=F401
80
+ import c2cgeoportal_commons.models.main # pylint: disable=unused-import,import-outside-toplevel
81
+ import c2cgeoportal_commons.models.static # pylint: disable=import-outside-toplevel
81
82
 
82
83
  # run configure_mappers after defining all of the models to ensure
83
84
  # all relationships can be setup
@@ -1,11 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cgeoportal-commons
3
- Version: 2.7.1.156
3
+ Version: 2.8.1.180
4
4
  Summary: c2cgeoportal commons
5
5
  Home-page: https://github.com/camptocamp/c2cgeoportal/
6
6
  Author: Camptocamp
7
7
  Author-email: info@camptocamp.com
8
+ License: UNKNOWN
8
9
  Keywords: web gis geoportail c2cgeoportal geocommune pyramid
10
+ Platform: UNKNOWN
9
11
  Classifier: Development Status :: 6 - Mature
10
12
  Classifier: Environment :: Web Environment
11
13
  Classifier: Framework :: Pyramid
@@ -18,15 +20,15 @@ Classifier: Programming Language :: Python :: 3.8
18
20
  Classifier: Topic :: Scientific/Engineering :: GIS
19
21
  Classifier: Typing :: Typed
20
22
  Description-Content-Type: text/markdown
21
- Requires-Dist: c2c.template
22
23
  Requires-Dist: GeoAlchemy2
24
+ Requires-Dist: c2c.template
25
+ Requires-Dist: jinja2 (>=3.1.3)
23
26
  Requires-Dist: papyrus
24
27
  Requires-Dist: pyramid
28
+ Requires-Dist: setuptools (>=65.5.1)
25
29
  Requires-Dist: sqlalchemy
26
30
  Requires-Dist: transaction
27
31
  Requires-Dist: zope.event
28
- Requires-Dist: jinja2 (>=2.11.3)
29
- Requires-Dist: setuptools (>=65.5.1)
30
32
  Provides-Extra: broadcast
31
33
  Requires-Dist: c2cwsgiutils ; extra == 'broadcast'
32
34
  Provides-Extra: testing
@@ -65,3 +67,5 @@ use `common/testing/initialized.py` to create the database (`development.ini` at
65
67
  ```
66
68
  make test
67
69
  ```
70
+
71
+