-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
allow seed rules to refer to columns #1254
Conversation
This makes a small change to the UI for entering seed rules, so that a seed rule that refers to a column may be added. This is a bit niche, but occasionally handy when all tables have some common structure.
app/client/aclui/AccessRules.ts
Outdated
@@ -1809,6 +1817,9 @@ class ObsRulePart extends Disposable { | |||
private _warnInvalidColIds(colIds?: string[]) { | |||
if (!colIds || !colIds.length) { return false; } | |||
const allValid = new Set(this._ruleSet.getValidColIds()); | |||
// Don't check column validity if we don't have any. | |||
// For example, the seed rule has no columns. | |||
if (allValid.size === 0) { return false; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are other cases of no-columns:
- the default rule (fallback for all tables). I think it would be hard to impossible to avoid it being an invalid rule then.
- the special rules. Using columns there would probably make them invalid too.
Can we maybe target seed rules more specifically here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will bring back some code for that, this just felt simpler but you're right, it is too broad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This makes a small change to the UI for entering seed rules, so that a seed rule that refers to a column may be added. This is a bit niche, but occasionally handy when all tables have some common structure.
Context
This was motivated by a user's experience adding a seed rule related to UUIDs:
https://community.getgrist.com/t/linkkey-access-rule-for-all-tables/6707
Proposed solution
We wait until a rule set is associated with some columns before checking column validity.
Has this been tested?