fix(tables): a new saved analysis, star, watch or run belongs to the inserting user
Found driving the Next UI against the sample app: the UI cannot send the user's id, and core checks required fields and record locks before the customizers run. An insert-only field behavior fills empty owner/user fields with the session user (never on update, so an administrator's partial edit cannot take ownership); naming another owner is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b3c8a0412a
commit
69154de566
3 files changed
+105
-4
No files matched your search
@@ -87,6 +87,23 @@ class SavedAnalysesTest extends EngineFixture
|
||||
assertThat(api.list()).isEmpty();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
** A UI insert without an owner belongs to the inserting user; naming someone
|
||||
** else is still refused for a non-administrator.
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
void insertWithoutOwnerBelongsToTheCurrentUser() throws Exception
|
||||
{
|
||||
QContext.init(instance, viewer("bob", 2));
|
||||
QRecord row = definition("bob", false, "COLUMN_PROFILE", Map.of("fieldName", "amount"));
|
||||
row.removeValue("owner_user_id");
|
||||
QRecord inserted = new InsertAction().execute(new InsertInput(DataAnalysisTables.SAVED).withRecords(List.of(row))).getRecords().getFirst();
|
||||
assertThat(inserted.getErrors()).isEmpty();
|
||||
assertThat(inserted.getValueString("owner_user_id")).isEqualTo("bob");
|
||||
QRecord forged = definition("alice", false, "COLUMN_PROFILE", Map.of("fieldName", "amount"));
|
||||
assertThat(new InsertAction().execute(new InsertInput(DataAnalysisTables.SAVED).withRecords(List.of(forged))).getRecords().getFirst().getErrors()).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void starsAreIdempotentAndPersonal() throws Exception
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user