moleculerjs / moleculerjs/database
Support writePermission property in fields
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 33
- Forks
- 15
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
A fairly common use case is to allow users to read all fields, but only allow admins to write some fields. This is not possible with the current readPermission / permission properties. One solution would be to add a writePermission property, or to modify the checkAttributes function to also pass in the opts object (which has the isWrite flag). The former solution seems cleaner.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the checkAttributes function and tracing how field readPermission, permission, and the opts object with isWrite are handled. Define the writePermission behavior so users can read fields while only permitted users can write them, then verify the existing permission behavior remains unchanged and add or update the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- authorization, databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100