feat(ACLs): Add missing acls: simulatorsAcl, cogUnitsAcl, appHostingAcl, chartsAdminAcl#2693
feat(ACLs): Add missing acls: simulatorsAcl, cogUnitsAcl, appHostingAcl, chartsAdminAcl#2693haakonvt wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds several new capability access control lists (ACLs) including AppHostingAcl, ChartsAdminAcl, CogUnitsAcl, and SimulatorsAcl, along with the AppExternalIdScope scope class and corresponding unit tests. The feedback suggests implementing a post_init method in AppExternalIdScope to convert external_ids to strings, ensuring type safety and consistency with other scope classes in the codebase.
| @dataclass(frozen=True) | ||
| class AppExternalIdScope(Capability.Scope): | ||
| _scope_name = "appExternalIdScope" | ||
| external_ids: list[str] | ||
|
|
||
| def as_tuples(self) -> set[tuple[str, str]]: | ||
| return {(self._scope_name, s) for s in self.external_ids} |
There was a problem hiding this comment.
To ensure type safety and prevent comparison failures in compare_capabilities (e.g., if external IDs are parsed as integers or other types), convert external_ids to strings in a __post_init__ method. This is consistent with other scopes like PostgresGatewayUsersScope and DataSetScope.
| @dataclass(frozen=True) | |
| class AppExternalIdScope(Capability.Scope): | |
| _scope_name = "appExternalIdScope" | |
| external_ids: list[str] | |
| def as_tuples(self) -> set[tuple[str, str]]: | |
| return {(self._scope_name, s) for s in self.external_ids} | |
| @dataclass(frozen=True) | |
| class AppExternalIdScope(Capability.Scope): | |
| _scope_name = "appExternalIdScope" | |
| external_ids: list[str] | |
| def __post_init__(self) -> None: | |
| object.__setattr__(self, "external_ids", [str(i) for i in self.external_ids]) | |
| def as_tuples(self) -> set[tuple[str, str]]: | |
| return {(self._scope_name, s) for s in self.external_ids} |
References
- Consistency: Follow established patterns across the codebase (e.g., converting list elements to their expected type in post_init as done in other scopes like PostgresGatewayUsersScope and DataSetScope). (link)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2693 +/- ##
==========================================
- Coverage 93.68% 93.66% -0.03%
==========================================
Files 498 498
Lines 50391 50443 +52
==========================================
+ Hits 47209 47246 +37
- Misses 3182 3197 +15
🚀 New features to boost your workflow:
|
No description provided.