Skip to content

Commit

Permalink
Add missing legacy scopes (#1547)
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonvt authored Dec 11, 2023
1 parent 87b3ac0 commit 7b76d90
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [7.5.5] - 2023-12-07
## [7.5.6] - 2023-12-11
### Added
- Missing legacy scopes for `Capability`: `LegacySpaceScope` and `LegacyDataModelScope`.

## [7.5.5] - 2023-12-11
### Added
- Added `poll_timeout` parameter on `time_series.subscriptions.iterate_data`. Will keep the connection open and waiting,
until new data is available, up to `poll_timeout` seconds.
Expand Down
2 changes: 1 addition & 1 deletion cognite/client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

__version__ = "7.5.5"
__version__ = "7.5.6"
__api_subversion__ = "V20220125"
20 changes: 20 additions & 0 deletions cognite/client/data_classes/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,24 @@ def as_tuples(self) -> set[tuple]:
return {(self._scope_name, s) for s in self.space_ids}


@dataclass(frozen=True)
class LegacySpaceScope(Capability.Scope):
_scope_name = "spaceScope"
external_ids: list[str]

def as_tuples(self) -> set[tuple]:
return {(self._scope_name, s) for s in self.external_ids}


@dataclass(frozen=True)
class LegacyDataModelScope(Capability.Scope):
_scope_name = "dataModelScope"
external_ids: list[str]

def as_tuples(self) -> set[tuple]:
return {(self._scope_name, s) for s in self.external_ids}


@dataclass(frozen=True)
class UnknownScope(Capability.Scope):
"""
Expand Down Expand Up @@ -937,6 +955,7 @@ class Action(Capability.Action):
class Scope:
All = AllScope
SpaceID = SpaceIDScope
LegacySpace = LegacySpaceScope


@dataclass
Expand All @@ -952,6 +971,7 @@ class Action(Capability.Action):
class Scope:
All = AllScope
SpaceID = SpaceIDScope
LegacyDataModel = LegacyDataModelScope


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "cognite-sdk"

version = "7.5.5"
version = "7.5.6"
description = "Cognite Python SDK"
readme = "README.md"
documentation = "https://cognite-sdk-python.readthedocs-hosted.com"
Expand Down
7 changes: 7 additions & 0 deletions tests/tests_unit/test_data_classes/test_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ def all_acls():
{"assetsAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}},
{"assetsAcl": {"actions": ["READ", "WRITE"], "scope": {"datasetScope": {"ids": ["372"]}}}},
{"dataModelInstancesAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}},
{"dataModelInstancesAcl": {"actions": ["READ"], "scope": {"spaceScope": {"externalIds": ["maintain"]}}}},
{"dataModelsAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}},
{
"dataModelsAcl": {
"actions": ["READ"],
"scope": {"dataModelScope": {"externalIds": ["maintain", "main-data"]}},
}
},
{"datasetsAcl": {"actions": ["READ", "WRITE", "OWNER"], "scope": {"all": {}}}},
{"datasetsAcl": {"actions": ["READ", "WRITE", "OWNER"], "scope": {"idScope": {"ids": ["2918026428"]}}}},
{"digitalTwinAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}},
Expand Down

0 comments on commit 7b76d90

Please sign in to comment.