Skip to content
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

feat: guest fixes added to missing save file fixes #377

Merged
merged 26 commits into from
Dec 16, 2024

Conversation

aaronm-2112
Copy link
Member

@aaronm-2112 aaronm-2112 commented Dec 16, 2024

Summary by Sourcery

Implement guest and editor role checks to conditionally skip pages in the guided mode, add network communication notifications, and update the CI workflow to trigger on a new branch.

New Features:

  • Introduce a feature to notify users if network settings may prevent communication with the Pennsieve platform.
  • Add functionality to resume dataset curation even if saved files have been deleted from the computer.

Enhancements:

  • Improve handling of user roles by skipping certain pages for guests and editors in the guided mode.
  • Enhance dataset metadata editing by checking user roles and skipping ineligible actions.

CI:

  • Update CI workflows to trigger on the 'guest-contributor-fixes' branch instead of 'folder-build'.

Documentation:

  • Update the changelog to document new features and version changes for v15.3.0.

aaronm-2112 and others added 26 commits December 2, 2024 15:14
Copy link

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

Copy link
Contributor

sourcery-ai bot commented Dec 16, 2024

Reviewer's Guide by Sourcery

This PR implements fixes for guest user access and permissions in the guided curation workflow. The changes ensure proper handling of different user roles (guest, editor, viewer) and their corresponding access levels to various dataset features.

Sequence diagram for checking user role and skipping pages

sequenceDiagram
    participant User
    participant UI
    participant API
    participant Client

    User->>UI: Navigate to a page
    UI->>API: getDatasetRole(datasetName)
    API-->>UI: role
    alt role is editor
        UI->>UI: Skip pages (permissions, banner, license)
    else role is not editor
        UI->>UI: Unskip pages (permissions, banner, license)
    end
    UI->>Client: Save progress
    Client-->>UI: Progress saved
Loading

Class diagram for updated functions in guided-curate-dataset.js

classDiagram
    class GuidedCurateDataset {
        +checkIfChangesMetadataPageShouldBeShown(pennsieveDatasetID)
        +savePageChanges(pageBeingLeftID)
        +openPage(targetPageID)
        +guidedResumeProgress(datasetNameToResume)
        +editPennsieveMetadata()
    }
    note for GuidedCurateDataset "New logic for handling guest and editor roles"
Loading

Class diagram for new function in globals.js

classDiagram
    class Globals {
        +isWorkspaceGuest() bool
    }
    note for Globals "New function to check if user is a guest in the workspace"
Loading

File-Level Changes

Change Details Files
Added guest user detection and permission handling
  • Added isWorkspaceGuest function to check if user is a guest in the workspace
  • Skip permission-related pages for guest users
  • Modified dataset role checks to handle editor and viewer permissions differently
src/renderer/src/scripts/globals.js
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
Enhanced metadata editing permissions and controls
  • Added checks to prevent editors from modifying certain metadata
  • Implemented role-based access control for dataset description, banner image, license, and tags
  • Created editPennsieveMetadata function to centralize metadata editing logic
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
src/pyflask/permissions/permissions.py
Fixed dataset identification and error handling
  • Updated dataset identification to use pennsieve-dataset-id when available
  • Improved error handling in API calls
  • Added proper logging for user roles and dataset operations
src/pyflask/organizeDatasets/organize_datasets.py
src/pyflask/manageDatasets/manage_datasets.py
src/renderer/src/scripts/others/api/api.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!

@aaronm-2112 aaronm-2112 merged commit 2f8a94b into file-loc-and-contr-fixes Dec 16, 2024
11 of 17 checks passed
Copy link

Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help!

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @aaronm-2112 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

}
}

if (ineligible) return { shouldShow: false };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (ineligible) return { shouldShow: false };
if (ineligible) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

}
}

if (ineligible) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (ineligible) return;
if (ineligible) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

}
}

if (ineligible) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (ineligible) return;
if (ineligible) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

}
}

if (ineligible) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (ineligible) return;
if (ineligible) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

}
}

if (ineligible) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (ineligible) return;
if (ineligible) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

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