Skip to content

Commit

Permalink
Integration tests glossaries/dashboard bugfix (#1765)
Browse files Browse the repository at this point in the history
### Feature or Bugfix
<!-- please choose -->
- Bugfix


### Detail
- MetadataForm Entity methods => uri(), catalog method => uri_column()
- frontend visibility bugfix

### Relates
- <URL or Ticket>

### Security
Please answer the questions below briefly where applicable, or write
`N/A`. Based on
[OWASP 10](https://owasp.org/Top10/en/).

- Does this PR introduce or modify any input fields or queries - this
includes
fetching data from storage outside the application (e.g. a database, an
S3 bucket)?
  - Is the input sanitized?
- What precautions are you taking before deserializing the data you
consume?
  - Is injection prevented by parametrizing queries?
  - Have you ensured no `eval` or similar functions are used?
- Does this PR introduce any functionality or component that requires
authorization?
- How have you ensured it respects the existing AuthN/AuthZ mechanisms?
  - Are you logging failed auth attempts?
- Are you using or adding any cryptographic features?
  - Do you use a standard proven implementations?
  - Are the used keys controlled by the customer? Where are they stored?
- Are you introducing any new policies/roles/users?
  - Have you used the least-privilege principle? How?


By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

---------

Co-authored-by: Sofia Sazonova <[email protected]>
  • Loading branch information
SofiaSazonova and Sofia Sazonova authored Feb 14, 2025
1 parent 8b3b94b commit c36d337
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 8 deletions.
4 changes: 2 additions & 2 deletions backend/dataall/modules/catalog/indexers/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class Identifiable(Protocol):
@classmethod
def uri(cls): ...
def uri_column(cls): ...


@dataclass
Expand All @@ -22,7 +22,7 @@ class GlossaryDefinition:
reindexer: Type[BaseIndexer] = None # a callback to reindex glossaries in open search

def target_uri(self):
return self.model.uri()
return self.model.uri_column()


class GlossaryRegistry(UnionTypeRegistry):
Expand Down
4 changes: 4 additions & 0 deletions backend/dataall/modules/dashboards/db/dashboard_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Dashboard(Resource, Base):

userRoleForDashboard = query_expression()

@classmethod
def uri_column(cls):
return cls.dashboardUri

def uri(self):
return self.dashboardUri

Expand Down
4 changes: 4 additions & 0 deletions backend/dataall/modules/datasets_base/db/dataset_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class DatasetBase(Resource, Base):
expiryMaxDuration = Column(Integer, nullable=True)
__mapper_args__ = {'polymorphic_identity': 'dataset', 'polymorphic_on': datasetType}

@classmethod
def uri_column(cls):
return cls.datasetUri

def owner_name(self):
return self.SamlAdminGroupName

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ class RedshiftTable(Base, Resource):
topics = Column(ARRAY(String), nullable=True)

@classmethod
def uri(cls):
def uri_column(cls):
return cls.rsTableUri
14 changes: 13 additions & 1 deletion backend/dataall/modules/s3_datasets/db/dataset_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DatasetTableColumn(Resource, Base):
columnType = Column(String, default='column') # can be either "column" or "partition"

@classmethod
def uri(cls):
def uri_column(cls):
return cls.columnUri


Expand Down Expand Up @@ -63,6 +63,10 @@ def entity_name(self):
def uri(self):
return self.locationUri

@classmethod
def uri_column(cls):
return cls.locationUri


class DatasetTable(Resource, Base):
__metaclass__ = MetadataFormEntity
Expand Down Expand Up @@ -95,6 +99,10 @@ def entity_name(self):
def uri(self):
return self.tableUri

@classmethod
def uri_column(cls):
return cls.tableUri


class S3Dataset(DatasetBase):
__tablename__ = 's3_dataset'
Expand Down Expand Up @@ -156,6 +164,10 @@ def entity_name(self):
def uri(self):
return self.bucketUri

@classmethod
def uri_column(cls):
return cls.bucketUri


class DatasetTableDataFilter(Resource, Base):
__tablename__ = 'data_filter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DatasetLock(Base):
acquiredBy = Column(String, nullable=True)

@classmethod
def uri(cls):
def uri_column(cls):
return cls.datasetUri


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class DatasetBucket(Resource, Base):
environmentEndPoint = query_expression()

@classmethod
def uri(cls):
def uri_column(cls):
return cls.bucketUri


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class DatasetLock(Base):
acquiredBy = Column(String, nullable=True)

@classmethod
def uri(cls):
def uri_column(cls):
return cls.datasetUri


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export const MetadataAttachment = (props) => {
<Autocomplete
disablePortal
options={availableForms}
value={selectedForm.name}
onChange={async (event, value) => {
if (value) {
setSelectedForm(value.form);
Expand Down

0 comments on commit c36d337

Please sign in to comment.