-
Notifications
You must be signed in to change notification settings - Fork 84
Review ACL Settings #359
Comments
Current implementationSkygear ServerFetching
Summary: When fetching, the Default ACL setting does not affect ACL evaluation. The Default ACL is returned (but not considered) if Saving
Summary: When saving, Default ACL setting does not affect ACL evaluation. If client save iOS SDK
JS SDK
Java SDK
My recommendationThis recommendations are made by considering the existing behaviour and to try to minimize breaking changes, while also considering what people expect and to avoid confusion in the future.
What will happen when the above is implemented
Existing issues
New issuesThese should have higher priority because there is a bug on the released version and people cannot modify ACL of records:
These should have medium priority:
These should have lower priority because they are new features: |
Questions:
What does it mean to set ACL in lambda?
When will client fetch the default ACL of record types from server? |
Sorry I wrote it hastily. I was meaning to say this: Louis described his use case in which he rarely set the ACL in client side SDK. In his project, he usually set the ACL in cloud code using lambda function. Since lambda function set the ACL directly using SQL, his use case is not really relevant in our discussion of how the client SDK should behave. (but still interesting).
Good question. “The client should remember the default ACL setting” meaning that when the developer sets the default ACL using |
What happens if someone try to mutate ACL without calling |
Sorry for being a bit off topic but here is a problem that I came across before. Putting access control logic in client (especially mobile client) is not a good idea.The access control of some table needs to be changed due to requirement change. The old client will keep saving record with old access control. I have to write |
“If there is no default ACL setting, the client should assume public-readable”. To answer your question, if In other words, calling // this is for illustration purpose only
// code does not need to look like this
// for example, `recordDefaultAccess` maybe written as a function that returns `publicReadable` if there is no default access defined
if (!this.access) this.access = recordDefaultAccess[this.recordType] || publicReadable
this.access.setReadOnlyForRole(role) |
No I think it is relevant. I think I agree with you that it is a good idea to put ACL logic server-side. I just want to add that if the developer wants ACL to apply on the server side, they can achieve this by never modifying the ACL of a record on the client side. Server will apply the default ACL and the client will respect that. The above recommendation is focused on developer who wants to put ACL logic client-side. If developer wants to put ACL logic server-side, I think they will be able to achieve that too. |
@limouren said |
The recommendation aligns with my expectation. |
The recommendation looks good to me. |
Look good to me |
Thanks for the thoughtful design. I want to bring up two issue:
|
@chpapa mentioned
These API applies to all record types and they are not a per-record setting. The existing (and also the proposed) API To make it backward compatible, we can deprecate Since these two API existed before we have a server-side default ACL setting, I have no intention of updating these API to update the server-side default ACL setting.
How will the recommendation break existing user in your thought? |
I know that account make heavy use of Cloud Functions, so would they really have some code that assume _access = null is public writable? |
@chpapa thinks |
Not sure, it seems a bad decision just for backward compatible for some rare edge case. |
I missed this. And I think |
Definitely. Sorry. I cannot be right all the time. 😆 |
In my document, all instances of “per-record” actually means “per-record-type”. The document is updated to fix this. |
If there are no further comments on the recommendation, I will create new GitHub issues for the implementation of the above recommendation. |
I opened new issues. Please see above. I prefer that I don’t do the coding for these issues but I expect that all of the PR for these issues to be addressed to me. Make sure that you have adequate unit tests. |
Can I propose @Steven-Chan do it all after switching in and @cheungpat review all? When will @Steven-Chan able to start? |
Turn out @Steven-Chan switch in and do the field ACL. It results:
I propose:
|
I move this to Milestone 3, as I'm not sure if it is related with the High Level Review of ACL / Field ACL. |
I will draft a follow-up with the following information:
_access
beingnull
_access=null
, what the client side assume is the effective ACL settingMy proposed behavior:
null
is always treated as public-read,null
is also the state if the ACL setting is not explicitly modifiednull
to server, sending null to server signify that the server will apply default ACL settingsnull
setting, the developer will modify the setting as if the ACL is public-read.Rick’s proposed behavior:
null
in the DB is treated as public-readnull
to server, sending null to server signify that the server will apply default ACL settingsnull
setting, the developer will modify the setting as if the ACL is the default ACL settings.Ben L’s proposed behavior:
null
(in database SQL) is always treated as public-readnull
to server (will send default ACL settings)Louis’s
proposed behavioruse case and suggestions:ACL setting is set in lambdaLouis’s use case is that he rarely set the ACL in client side SDK. In his project, he usually set the ACL in cloud code using lambda function.null
column is treated public-read and the database column is not nullablenull
I will recommend a solution that is the most consistent with the existing behavior.
The text was updated successfully, but these errors were encountered: