Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to restrict script execution to certain object fields #2485

Closed
3 tasks done
mtrezza opened this issue Jun 28, 2023 · 7 comments · Fixed by #2488
Closed
3 tasks done

Allow to restrict script execution to certain object fields #2485

mtrezza opened this issue Jun 28, 2023 · 7 comments · Fixed by #2488
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version type:feature New feature or improvement of existing feature

Comments

@mtrezza
Copy link
Member

mtrezza commented Jun 28, 2023

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.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Jun 28, 2023

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza mtrezza added type:feature New feature or improvement of existing feature bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) labels Jun 28, 2023
@mtrezza mtrezza changed the title Allow to restrict script execution to certain fields Allow to restrict script execution to certain object fields Jun 28, 2023
@patelmilanun
Copy link
Member

U want to hide it from the context menu or just prevent execution or show some alert that this can't be performed?

@mtrezza
Copy link
Member Author

mtrezza commented Jun 28, 2023

I'd hide it, I don't see much use in showing a disabled script when the user has no way to enable it.

If an action was required by the user to enable it, then it may make sense to show it disabled; for example if a script would only be enabled based on certain field values that the user can change. But we don't have such a feature (yet).

@patelmilanun
Copy link
Member

Ok got it

@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.0.0-alpha.8

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jun 27, 2024
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.0.0-beta.2

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Oct 7, 2024
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.0.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version type:feature New feature or improvement of existing feature
Projects
None yet
3 participants