-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Describe the bug
If a user is granted exclusively non-default roles (so not any of {admin, operator, viewer}), the frontend of ScriptRunner does not allow editing of the script.
To Reproduce
Steps to reproduce the behavior:
- Create a new user and role in Keycloak. Map that role to the user. Ensure that the role is prefixed with
ALLSCOPES__
to map to OpenC3 roles. - Create a Role in the OpenC3 Admin Console's Role editor that corresponds to the role created in Keycloak. Grant the following permissions (at least, more can be granted): script_view, script_edit, script_run, system_set
- Log into OpenC3 with the custom user created in step 1. Open the ScriptRunner tool.
Expected behavior
Because the user has been granted script_* and system_set permissions, they should be allowed to edit and save scripts in the ScriptRunner frontend.
Actual behavior
When a user attempts to edit (pressing a key on the keyboard with the editor focused), a tooltip shows up saying "Editing is disabled.".
After running a script, this limitation seems to go away. The same user can now edit the contents of the script within the editor, and save them back to the bucket they exist in. However, the cursor within the editor does not properly show up (style: none
is present on the cursor object in the DOM).
Our guess when poking at this live was that there is some race/sync bug between the ace editor's reactivity to state updates with respect to the resolution of await
ing the API call to get custom roles, as opposed to checking against default roles which does not require an API call.
Environment
- OS: Windows 11
- OpenC3 COSMOS 6.4.2
- Browser: Chrome