-
Notifications
You must be signed in to change notification settings - Fork 32
✨ [Frontend] Check if I can write_functions
#7888
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
✨ [Frontend] Check if I can write_functions
#7888
Conversation
write_functions
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.
Pull Request Overview
This PR ensures that the “Create Functions” section is only shown when the user’s group has the write_functions permission by:
- Adding a new
functionPermissionsendpoint and loading both general and function-specific permissions at startup - Refactoring
Permissionsto store and expose group-level and function-level permissions viacheckMyGroupCanDoandcheckFunctionPermissions - Updating UI components (
NodeOptions,ResourceDetails) to use the new permission checks and automatically rebuild layouts
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| services/static-webserver/client/source/class/osparc/widget/NodeOptions.js | Renamed buildLayout to private __buildLayout and applied it on node property; switched permission check to checkMyGroupCanDo |
| services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js | Removed manual buildLayout call now handled by the property apply |
| services/static-webserver/client/source/class/osparc/desktop/MainPage.js | Preload both general and function permissions before rendering |
| services/static-webserver/client/source/class/osparc/data/Resources.js | Added functionPermissions resource definition |
| services/static-webserver/client/source/class/osparc/data/Permissions.js | Introduced __permissions and __functionPermissions, methods to fetch and check them |
| services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js | Changed plugin-disabled check to use checkFunctionPermissions |
Comments suppressed due to low confidence (3)
services/static-webserver/client/source/class/osparc/data/Permissions.js:300
- [nitpick] Consider adding a JSDoc comment to explain the purpose of
fetchFunctionPermissionsand its relationship with__functionPermissions.
fetchFunctionPermissions: function() {
services/static-webserver/client/source/class/osparc/desktop/MainPage.js:73
- New startup permission-fetching logic should be covered by tests to ensure both general and function permissions are loaded before the UI displays.
preloadPromises.push(osparc.data.Permissions.getInstance().fetchPermissions());
services/static-webserver/client/source/class/osparc/data/Permissions.js:317
- The variable
functionPermissionsis undefined here; it should referencethis.__functionPermissions[action].
return functionPermissions[action];
|
|
@mergify queue |
🟠 Waiting for conditions to match
|
write_functionswrite_functions
pcrespov
left a comment
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.
thx



What do these changes do?
In order to show the
Create Functionssection, the user needs to belong to a group that is allowed towrite_functions.Related issue/s
/me/function-permissionsEndpoint in Functions Domain #7901How to test
Dev-ops