Skip to content

Allow to restrict script execution to certain object fields #2485

Closed
@mtrezza

Description

@mtrezza

New Feature / Enhancement Checklist

Current Limitation

Script execution can only be restricted per class, not per field.

Feature / Enhancement Description

Allow to restrict script execution to certain fields.

The syntax could be:

<ClassName>$<FieldName>

Not sure which delimiter is best to use. We're already using the $ internally in Parse Server to store a Parse Object pointer in the database with the same syntax of <ClassName>$<FieldName>. And $ is not allowed in a class or field name, so this may be most consistent.

Example Use Case

For example, a purchase transaction in which there is a buyingUser and sellingUser, but only the buyingUser can be flagged:

"apps": [
  {
    "scripts": [
      {
        "title": "Flag fraudulent purchase",
        "classes": ["Transaction$buyingUser"],
        "cloudCodeFunction": "flagUser"
      }
    ]
  }
]

Alternatives / Workarounds

The field can be determined server-side with selectedField param, to prohibit the script execution. However, for the dashboard user, it still seems possible to execute a script on a field even thought the server will refuse it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$20Bounty applies for fixing this issue (Parse Bounty Program)state:releasedReleased as stable versionstate:released-alphaReleased as alpha versionstate:released-betaReleased as beta versiontype:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions