atviriduomenys / spinta

Spinta is a framework to describe, extract and publish data (a DEP Framework).
MIT License
10 stars 4 forks source link

Sync permission error #541

Closed sirex closed 7 months ago

sirex commented 7 months ago

I have a following manifest:

d | r | b | m | property | type    | ref      | source     | level | access
example                  |         |          |            |       |
  | db                   | sql     | external |            |       |
  |   |   | Country      |         | id       | countries  | 4     |
  |   |   |   | id       | integer |          | id         | 4     | protected
  |   |   |   | name     | string  |          | name       | 4     | open
  |   |   | City         |         | id       | cities     | 4     |
  |   |   |   | id       | integer |          | id         | 4     | protected
  |   |   |   | name     | string  |          | name       | 4     | open
  |   |   |   | country  | ref     | Country  | country_id | 4     | open

When I try to push data:

spinta copy sdsa.txt --no-source --access open -o adsa.csv
spinta bootstrap adsa.csv
spinta run adsa.csv
spinta push sdsa.txt -o test@localhost

I get following error:

Traceback (most recent call last):
  File "spinta/cli/push.py", line 205, in push
    sync_keymap(
  File "spinta/datasets/keymaps/synchronize.py", line 30, in sync_keymap
    raise UnauthorizedKeymapSync(model)
spinta.exceptions.UnauthorizedKeymapSync: You do not have permission to sync this model's keymap.
  Context:
    component: spinta.components.Model
    manifest: default
    schema: 4
    dataset: example
    resource: db
    model: example/Country
    entity: countries
    resource.backend: external

Keymap sync should only run auto-sync for models, that do not have external resource and are referenced by models who have external resource.

In the example above, both models have external resource, and should not be auto-synced.

Related