Skip to content

✨ [Frontend] Check if my group 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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

odeimaiz
Copy link
Member

@odeimaiz odeimaiz commented Jun 12, 2025

What do these changes do?

In order to show the Create Functions section, make sure the user can create functions.

Related issue/s

How to test

Dev-ops

@odeimaiz odeimaiz self-assigned this Jun 12, 2025
@odeimaiz odeimaiz added t:enhancement Improvement or request on an existing feature a:frontend issue affecting the front-end (area group) release Preparation for pre-release/release labels Jun 12, 2025
@odeimaiz odeimaiz added this to the Engage milestone Jun 12, 2025
@odeimaiz odeimaiz changed the title ✨ [Frontend] Check if my group can do Functions ✨ [Frontend] Check if my group can write_functions Jun 12, 2025
@odeimaiz odeimaiz requested a review from Copilot June 12, 2025 15:11
Copy link
Contributor

@Copilot Copilot AI left a 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 functionPermissions endpoint and loading both general and function-specific permissions at startup
  • Refactoring Permissions to store and expose group-level and function-level permissions via checkMyGroupCanDo and checkFunctionPermissions
  • 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 fetchFunctionPermissions and 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 functionPermissions is undefined here; it should reference this.__functionPermissions[action].
return functionPermissions[action];

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:frontend issue affecting the front-end (area group) release Preparation for pre-release/release t:enhancement Improvement or request on an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant