-
Notifications
You must be signed in to change notification settings - Fork 33
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
setReadWriteAccessForRole on new record result in TypeError: this.access is null
#203
Comments
Need a test case for this one too |
Because now default ACL is in server side, we need to do something like
Implemented an endpoint for fetching default ACL, JS updates coming |
Do you suggest this should be the behavior for all other SDKs? |
The above code should be run only when access is null? When access is not null it could meant the record was fetched and shouldn't override with default ACL? Without much modern JS experience so just a guess. Or another way of speaking is I think the access properties should replaced with a getter and fetch default if null? Also what if the sdk was used at offline environment? The SDK should be usable in offline. |
Let look back to the issue trigger the change: SkygearIO/skygear-server#309 Main point: We removed the assumption of developers having whole record knowledge. I think that why we still have setDefaultACL? So before adding the
my suggested solution
docI also discover the new release is not yet reflected to https://docs.skygear.io/guides/cloud-db/acl/js/ |
sync call and async call is not capitable in JS. So language wise, it is not possible. Or you will need to add many flag to make it happen and the code base wiil become not maintable.
What do you mean?? Current SDK cannot save record when the device is offline... |
Sorry I meant to say it should be able to handle no / bad network situation at best effort, thus calling fetch default ACL Everytime is no good. Your suggestion of caching in last message would be acceptable to me.
I think these two are not good enough. Users don't read docs in details as we know. Can we just cache the defaultACL and update it when called manually / times when it is used and in good network condition? |
My suggestion is that:
Therefore this is my suggestion for implementation:
|
I don’t see why we should treat the access control attribute any differently than any other record attributes when saving. If the client side does not specify a value, the server decides the value. If the client side specified a value, the client side will override whatever value existing on the server. On the other hand, I am okay with fetching default access control from the server. I am just against automagically setting the ACL on new record when client creating a new record. |
@cheungpat in your suggestion, what would |
I am okay with @rickmak’s suggestion to merge The
Let me clarify that new record will not have default ACL (meaning access control setting is
|
Don’t worry. If the developer calls Since the ACL is only useful at the server side, having ACL setting as |
It was a mistake I didn't remove Re rick's suggestion on asking user to call |
I will be reviewing the ACL settings (sorry), please take a look at @b123400 and see if you want to make a proposal there. |
This will be superseded by #208 but we should keep this open to verify that this issue is fixed. |
Expected Results
Set the ACL correctly.
Actual Results
TypeError: this.access is null
Steps to reproduce
The text was updated successfully, but these errors were encountered: