aws-amplify / aws-amplify/amplify-data

Allow creating a model that does not 'allow' anyone.

Open
#569 4 comments 0 reactions 2 assignees Claimed by @stocaaro View on GitHub
data-schema feature-request
Dominant language
TypeScript
Stars
18
Forks
23
Avg merge
26m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**

I am creating a model that my users do not access directly. As such, I do not want to be forced to _allow_ anyone.

**Describe the solution you'd like**

Either:
- simply deny by default if `.authorization()` is not called
- provide `allow.nobody()` as in `.authorization((allow) => [allow.nobody()])` which allows the user to be explicitly deny access.

**Describe alternatives you've considered**

As a temporary workaround, I've chosen to use `@auth(rules: [{allow: owner, ownerField: "_never_"}])` which is a field that wont be populated. I still see, however, that there is an unwanted field resolver defined automatically called `MyModel_never_DataResolverFn`.

```typescript

.authorization((allow) => [allow.ownerDefinedIn('_never_')]);

```

**Additional context**

Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.