Skip to content

Policy without role get's treten as public-policy #170

@Dominic-Marcelino

Description

@Dominic-Marcelino

Describe the bug
The extension uses a custom flag _sync_default_public_policy for the default public policy. However, after a custom policy is added which isn't related to a role (but assigned to a single user), the extension tries to save it as a second default public policy on a pull, which creates the error below:

insert into `directus_sync_id_map` (`local_id`, `sync_id`, `table`) values ('25c4d514-026a-400d-beeb-398b078b8ea6', '_sync_default_public_policy', 'policies') - Duplicate entry 'policies-_sync_default_public_policy' for key 'directus_sync_id_map_table_sync_id_unique'

After adding the policy manually to the directus_sync_id_map table (keeping the id), everything works as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Create a policy which isn't assigned to a role
  2. Run directus-sync pull
  3. See error

Expected behavior
Recognize that it's a user-related policy.

Versions (please complete the following information):

  • Directus-Sync version: 3.0.3
  • Directus version: 11.6.1
  • Database: MySql
  • Directus environment: Docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions