Fix for RBAC on apps built from templates containing public screens #5134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix for #5103 - some templates are built on an older version that stored permissions differently, we can't migrate these as they will keep being added, easiest to just support the old method (apply the old rule and convert to the new format when retrieving roles).
This fixes the templates which contain public roles, converted the roles which are stored as:
to
Which is the new method. Previously "write" as a string implied "read" but that was updated a little while ago. Its easy enough to convert this when reading roles and resolve the issue where used, making use of the older rule that write is a higher level than read.
This also introduces the ability to set a public write, but have a basic read, and the table schema will use the lower of the two roles which provides it access - table schemas see if either of the levels would provide access using the
{ schema: true }
option on the authorized middleware.