Skip to content

WEG-323 fix visibility issue when creating a new variable in a model restricted folder - #2115

Merged
TehAwol merged 1 commit into
devfrom
WEG-323
Oct 22, 2026
Merged

TehAwol merged 1 commit into
devfrom
WEG-323

Conversation

@xgo-work

@xgo-work xgo-work commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

In short, (claude extract)

In wegas-app/src/main/node/wegas-react/src/Editor/Components/EntityEditor.tsx.

  1. getEntity() (l.393-398), for a VariableCreate edition, returns a bare shell { '@Class', parentId, parentType }. It has no id and no visibility.
  2. overrideSchema() (l.165-176) runs for every scenario (gameModel.type === 'SCENARIO') and calls _overrideSchema, which calls getVisibility('PRIVATE', undefined, entity) (l.72-95).
  3. The shell has no own visibility and no inherited value, so getVisibility falls into its parent walk (Helper.getParent, which resolves parentType/parentId). It returns the folder's 'PROTECTED'.
  4. readOnly = PROTECTION_LEVELS.indexOf('PROTECTED') <= PROTECTION_LEVELS.indexOf('PROTECTED'), which is true. view.readOnly is then set recursively on the whole schema, except for fields that declare a lower protectionLevel such as defaultInstance.
  5. After the first save the server returns visibility: 'PRIVATE', so the "own visibility" branch wins and the form is editable.

Implemented solution

Edit getVisibility in EntityEditor.tsx so that an unsaved variable descriptor never inherits visibility from its parent. It uses the defaultValue ('PRIVATE'), as the legacy client and the server do:

@xgo-work xgo-work changed the title fix visibility issue when creating a new variable in a model restricted folder WEG-323 fix visibility issue when creating a new variable in a model restricted folder Oct 19, 2026
@TehAwol
TehAwol merged commit 55dda85 into dev Oct 22, 2026
1 check passed
@TehAwol
TehAwol deleted the WEG-323 branch October 22, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants