Skip to content

Commit

Permalink
Merge pull request #378 from fairdataihub/guest-contributor-fixes-ui-…
Browse files Browse the repository at this point in the history
…update

feat: Pennsieve guest contributors can use Prepare Dataset Step-by-Step
  • Loading branch information
aaronm-2112 authored Dec 26, 2024
2 parents 4c7a49f + 038e607 commit a00ba2c
Show file tree
Hide file tree
Showing 18 changed files with 283 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build-and-deploy-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- main
- staging
- pre-staging
- folder-build
- guest-contributor-fixes-ui-update

jobs:
deploy-on-linux:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Build-and-deploy-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- main
- staging
- pre-staging
- folder-build
- guest-contributor-fixes-ui-update

jobs:
deploy-on-mac:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Build-and-deploy-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- main
- staging
- pre-staging
- folder-build
- guest-contributor-fixes-ui-update

jobs:
deploy-on-windows:
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Feature Additions:

- SODA notifies the client when a firewall may be blocking access to Pennsieve.
- Pennsieve guest users can use the Prepare Datset Step-by-Step to edit their Pennsieve datasets.
- Prepare Dataset Step-by-Step progress can now be resumed when temporary data files on the user machine are saved, and when saved files have been moved.
- SODA's server starts faster on Mac computers.
- SODA will notify users if it is determined that a network setting may be preventing communication to the Pennsieve platform.
- The `Prepare Dataset Step-by-Step` feature allows users to resume curating a dataset even when that dataset saved files that have since been deleted from the computer.


## Bug Fixes:

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "soda-for-sparc",
"procductName": "SODA for SPARC",
"version": "15.2.4-beta",
"version": "15.3.9-beta",
"description": "Keep Calm and Curate",
"main": "./out/main/index.js",
"author": "SODA Team",
Expand Down
4 changes: 3 additions & 1 deletion src/pyflask/manageDatasets/manage_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ def filter_dataset(datasets_list, store=None):
r = requests.get(f"{PENNSIEVE_URL}/datasets/{str(selected_dataset_id)}/role", headers=create_request_headers(get_access_token()))
r.raise_for_status()
user_role = r.json()["role"]
if user_role not in ["viewer", "editor"]:
namespace_logger.info(f"User role: {user_role}")
if user_role not in ["viewer"]:
store.append(
{"id": selected_dataset_id, "name": dataset['name'], "role": user_role, "intId": dataset["intId"]}
)
Expand All @@ -358,6 +359,7 @@ def filter_dataset(datasets_list, store=None):
[t.join() for t in threads]

sorted_bf_datasets = sorted(store, key=lambda k: k["name"].upper())
namespace_logger.info(f"Sorted datasets: {sorted_bf_datasets}")
return {"datasets": sorted_bf_datasets}

def get_username(accountname):
Expand Down
15 changes: 9 additions & 6 deletions src/pyflask/organizeDatasets/organize_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,13 +1157,16 @@ def createFolderStructure(subfolder_json, manifest):
# START
start = timer()

# check that the Pennsieve dataset is valid
try:
bf_dataset_name = soda_json_structure["bf-dataset-selected"]["dataset-name"]
except Exception as e:
raise e
if "digital-metadata" in soda_json_structure and "pennsieve-dataset-id" in soda_json_structure["digital-metadata"]:
selected_dataset_id = soda_json_structure["digital-metadata"]["pennsieve-dataset-id"]
else:
# check that the Pennsieve dataset is valid
try:
bf_dataset_name = soda_json_structure["bf-dataset-selected"]["dataset-name"]
except Exception as e:
raise e

selected_dataset_id = get_dataset_id(bf_dataset_name)
selected_dataset_id = get_dataset_id(bf_dataset_name)

# check that the user has permission to edit this dataset
try:
Expand Down
2 changes: 1 addition & 1 deletion src/pyflask/permissions/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ def has_edit_permissions(ps_or_token, selected_dataset_id):
except Exception as e:
abort(500, "Could not get permissions for this dataset.")

return role in ["owner", "manager"]
return role in ["owner", "manager", "editor"]
2 changes: 1 addition & 1 deletion src/pyflask/startup/minimumApiVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def get_api_version():
"""


return {'version': os.getenv('API_VERSION', "15.2.4-beta")}
return {'version': os.getenv('API_VERSION', "15.3.9-beta")}



Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DropDownNote = ({ dropDownIcon, dropDownButtonText, dropDownNote }) => {
{dropDownIcon && dropDownIcons[dropDownIcon]}
<Text
td="underline"
size="lg"
size="md"
className={classes.dropDownButtonText}
style={{
marginLeft: "4px",
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/src/scripts/disseminate/prePublishingReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,12 @@ window.beginPrepublishingFlow = async (curationMode) => {
},
});
}

// check if the user is the dataset owner
let role;
try {
role = await api.getDatasetRole(currentDataset);
// check if the user is the dataset owner
const { userRole, userCanModifyPennsieveMetadata } =
await api.getDatasetAccessDetails(currentDataset);
role = userRole;
} catch (error) {
// tell the user something went wrong getting access to their dataset permissions
await Swal.fire({
Expand Down
24 changes: 24 additions & 0 deletions src/renderer/src/scripts/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -2187,6 +2187,30 @@ const get_api_key = (login, password, key_name) => {
});
};

window.isWorkspaceGuest = async () => {
let userInfo = await api.getUserInformation();
let currentWorkspace = userInfo["preferredOrganization"];

let orgResponse;
try {
orgResponse = await client.get(`user/organizations`, {
params: {
selected_account: window.defaultBfAccount,
},
});
} catch (error) {
clientError(error);
console.error("Error fetching organizations", error);
// TODO: Handle error here
}
console.log("currentWorkspace", currentWorkspace);
// get the current workspace by matching the id
let currentWorkspaceObj = orgResponse.data.organizations.filter(
(org) => org.organization.id === currentWorkspace
)[0];
return currentWorkspaceObj.isGuest;
};

export {
currentConTable,
showHideDropdownButtons,
Expand Down
Loading

0 comments on commit a00ba2c

Please sign in to comment.