Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

Readonly Records on create #40

Closed
grendo opened this issue May 25, 2017 · 4 comments
Closed

Readonly Records on create #40

grendo opened this issue May 25, 2017 · 4 comments

Comments

@grendo
Copy link

grendo commented May 25, 2017

If I have user A that has read access to a record, (that does not exist yet, ie no create permission).
And I have a active data provider that listens for that record, then goes off and gets the real data and sets it into deepstream.

What should happen when user A calls the Record.get as the doco says it creates the record if it does not exist. eg I only want the active data provider to create the record.

@yasserf
Copy link
Contributor

yasserf commented May 25, 2017

Hey, that's a great question!

We are currently looking at the possibility of being able to subscribe to something that doesn't exist, basically providing a subscription only request. This is done by some amendments we are making to the protocol that only does a subscribe without a create.

I'm not sure what a temporary solution is without allowing creation but not allowing writes. I understand this is not ideal but we should hopefully have a fix in the near future!

@grendo
Copy link
Author

grendo commented May 25, 2017

ok thanks, allowing the create and no write for users gets things going. Only downside is a user could create some records you do not want in the system but you should be able to minimize that through application code. I look forward to the new feature in the future.

@grendo
Copy link
Author

grendo commented Jun 4, 2017

Also a feature where you could know when the record was last written would be handy in the scenario described above. For example when a client subscribes to a record and it is readonly for them, the active data provider will get notified. Then I only want to refresh the record if it is > then say 1 hour old. I can store the write date in the record but it sounds like something that could be part of deepstream. The last written could also be useful if you wanted to implement something like Time To Live, (TTL), on the records so they can expire like in a cache.

@yasserf
Copy link
Contributor

yasserf commented Oct 1, 2019

This is implemented in V4 JS client using the readonlyFlag, which tells the client to only subscribe read and not create. This is a blanket feature, if you use it you would then need to explicitly mention the records you want to use write features on (prefixes).

    recordReadOnlyMode: boolean
    recordPrefixWriteWhitelist: string[]

In terms of TTL, that logic would need to exist in your providers or a custom cache layer.

@yasserf yasserf transferred this issue from deepstreamIO/deepstream.io May 3, 2020
@jaime-ez jaime-ez closed this as completed Mar 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants