https://github.com/pyramation/graphile-column-privileges-mutations
enable use of column-level SELECT grants, while still providing auto-generated mutations within PostGraphile
https://github.com/pyramation/graphile-column-privileges-mutations
Last synced: about 1 year ago
JSON representation
enable use of column-level SELECT grants, while still providing auto-generated mutations within PostGraphile
- Host: GitHub
- URL: https://github.com/pyramation/graphile-column-privileges-mutations
- Owner: pyramation
- License: mit
- Created: 2020-09-24T00:32:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-30T23:15:42.000Z (over 5 years ago)
- Last Synced: 2025-03-13T02:03:51.564Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 41 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# graphile-column-privileges-mutations [](https://travis-ci.org/pyramation/graphile-column-privileges-mutations)
```sh
npm install graphile-column-privileges-mutations
```
This [PostGraphile](http://postgraphile.org/) schema plugin was built to enable use of column-level SELECT grants, while still providing auto-generated mutations within PostGraphile. It works by using primary or unique constraints.
To give you a sense of why/where this plugin was born: https://github.com/graphile/graphile-engine/issues/260
## Usage
1. Disable the default mutations in your graphile settings object
2. Append the new plugins!
3. Enjoy!
```js
app.use(
postgraphile(connectionStr, schemas, {
appendPlugins: [
PgMutationCreatePlugin,
PgMutationUpdateDeletePlugin
],
graphileBuildOptions: {
// disable the default mutations
pgDisableDefaultMutations: true
}
})
);
```
## Examples
Example with app users and select grants here:
https://github.com/pyramation/graphile-column-select-grants-example
## Testing
```sh
createdb mutation_example
psql mutation_example < sql/roles.sql
psql mutation_example < sql/user.sql
psql mutation_example < sql/schema.sql
yarn test
```