Skip to content

Commit

Permalink
Merge pull request #158 from hydroserver2/80-private-obs
Browse files Browse the repository at this point in the history
Add isDataVisible to datastream table
  • Loading branch information
daniel-slaugh authored Dec 5, 2023
2 parents a235a30 + 43b2713 commit bc0a62d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/endpoints/datastream/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class DatastreamFields(Schema):
data_source_id: UUID = Field(None, alias='dataSourceId')
data_source_column: str = Field(None, alias='dataSourceColumn')
is_visible: bool = Field(True, alias='isVisible')
is_data_visible: bool = Field(True, alias='isDataVisible')
thing_id: UUID = Field(..., alias='thingId')
sensor_id: UUID = Field(..., alias='sensorId')
observed_property_id: UUID = Field(..., alias='observedPropertyId')
Expand Down
1 change: 1 addition & 0 deletions core/endpoints/observations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def apply_observation_auth_rules(
))
else:
auth_filters.append(Q(datastream__thing__is_private=False))
auth_filters.append(Q(datastream__is_data_visible=True))

if require_ownership:
auth_filters.append(
Expand Down
23 changes: 23 additions & 0 deletions core/migrations/0004_datastream_is_data_visible_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.1 on 2023-12-04 18:47

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0003_unitchangelog_thingchangelog_and_more'),
]

operations = [
migrations.AddField(
model_name='datastream',
name='is_data_visible',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='datastreamchangelog',
name='is_data_visible',
field=models.BooleanField(default=True),
),
]
1 change: 1 addition & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class Datastream(models.Model):
phenomenon_end_time = models.DateTimeField(null=True, blank=True, db_column='phenomenonEndTime')

is_visible = models.BooleanField(default=True)
is_data_visible = models.BooleanField(default=True)
data_source = models.ForeignKey(DataSource, on_delete=models.SET_NULL, null=True, blank=True)
data_source_column = models.CharField(max_length=255, null=True, blank=True)

Expand Down

0 comments on commit bc0a62d

Please sign in to comment.