Skip to content

Author can select relational content that another user created. #7696

@Naxos84

Description

@Naxos84

Describe the bug
When a user has the role "author" he can only see and edit the content that was created by the user.
When a content-type contains a relation field to another content-type then the user can select an entry that was not created by him.

Steps to reproduce the behavior

  1. create 2 users. (Author A, Author B)
  2. assign both users the Author role.
  3. create 2 content-types (A and B)
    3.1 add a relation field in A of type B
  4. add at least 1 content entry of type B with Author B
  5. add a content entry of type A with Author A
  6. expand the dropdown for the relational field and see the entry that Author B created.

Expected behavior
Author A should not be able to select relational content that was not created by himself.

Screenshots
Authorbug1
Authorbug2
Authorbug3
Authorbug4

Code snippets
//shop.settings.json

{
  "kind": "collectionType",
  "connection": "default",
  "collectionName": "shops",
  "info": {
    "name": "Shop"
  },
  "options": {
    "increments": true,
    "timestamps": true
  },
  "attributes": {
    "pages": {
      "via": "shops",
      "collection": "page",
      "dominant": true
    },
    "identifier": {
      "type": "string",
      "required": true,
      "unique": true
    },
    "name": {
      "type": "string",
      "required": true
    },
  }
}

//page.settings.json

{
  "kind": "collectionType",
  "connection": "default",
  "collectionName": "pages",
  "info": {
    "name": "Page"
  },
  "options": {
    "increments": true,
    "timestamps": true
  },
  "attributes": {
    "slug": {
      "type": "string",
      "required": false,
      "unique": false
    },
    "metaTitle": {
      "type": "string"
    },
    "title": {
      "type": "string",
      "required": true
    },
    "shops": {
      "collection": "shop",
      "via": "pages"
    }
  }
}

System

  • Node.js version: v12.16.0
  • NPM version: 6.13.4
  • Strapi version: 3.1.3
  • Database: sqlite
  • Operating system: windows 10

Additional context
None

If you need more information please let me know.

In the meantime: Is it possible to implement the expected filter behaviour on my end via Controller/Services?

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: enhancementIssue suggesting an enhancement to an existing featureseverity: lowIf the issue only affects a very niche base of users and an easily implemented workaround can solve

    Type

    No type

    Projects

    Status

    Archive

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions