Skip to content

Odeimaiz feature/user access rights #67

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
qx.Class.define("osparc.component.export.SaveAsTemplate", {
extend: qx.ui.core.Widget,

construct: function(studyId, formData) {
construct: function (studyId, formData) {
this.base(arguments);

this.__studyId = studyId;
Expand All @@ -34,7 +34,7 @@ qx.Class.define("osparc.component.export.SaveAsTemplate", {
},

statics: {
createSaveAsTemplateWindow: function(saveAsTemplate) {
createSaveAsTemplateWindow: function (saveAsTemplate) {
const window = new qx.ui.window.Window("Save as Template").set({
appearance: "service-window",
layout: new qx.ui.layout.Grow(),
Expand All @@ -60,7 +60,7 @@ qx.Class.define("osparc.component.export.SaveAsTemplate", {
__formData: null,
__shareWith: null,

__buildLayout: function() {
__buildLayout: function () {
const shareWith = this.__shareWith = new osparc.component.export.ShareWith("saveAsTemplate");
this._add(shareWith, {
flex: 1
Expand All @@ -77,7 +77,7 @@ qx.Class.define("osparc.component.export.SaveAsTemplate", {
this._add(saveAsTemplateBtn);
},

__saveAsTemplate: function(btn) {
__saveAsTemplate: function (btn) {
btn.setFetching(true);

const selectedGroupIDs = this.__shareWith.getSelectedGroups();
Expand All @@ -87,7 +87,7 @@ qx.Class.define("osparc.component.export.SaveAsTemplate", {

const params = {
url: {
"study_url": this.__studyId
"study_id": this.__studyId
},
data: this.__formData
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ def _create_new_node_uuid(old_uuid):
for node_uuid in project.get("workbench", {}).keys():
nodes_map[node_uuid] = _create_new_node_uuid(node_uuid)

project_map = {project["uuid"]: project_copy["uuid"]}

def _replace_uuids(node):
if isinstance(node, str):
node = nodes_map.get(node, node)
# NOTE: for datasets we get something like project_uuid/node_uuid/file_id
if "/" in node:
parts = node.split("/")
node = "/".join(_replace_uuids(part) for part in parts)
else:
node = project_map.get(node, nodes_map.get(node, node))
elif isinstance(node, list):
node = [_replace_uuids(item) for item in node]
elif isinstance(node, dict):
Expand All @@ -44,12 +51,14 @@ def _replace_uuids(node):
new_key = nodes_map[key]
node[new_key] = node.pop(key)
key = new_key

node[key] = _replace_uuids(value)
return node

project_copy["workbench"] = _replace_uuids(project_copy.get("workbench", {}))
return project_copy, nodes_map


@safe_return(if_fails_return=False, logger=log)
def substitute_parameterized_inputs(
parameterized_project: Dict, parameters: Dict
Expand All @@ -74,7 +83,10 @@ def _normalize_value(s):
return s

def _get_param_input_match(name, value, access) -> Optional[Match[AnyStr]]:
if isinstance(value, str) and access.get(name, "ReadAndWrite") == "ReadAndWrite":
if (
isinstance(value, str)
and access.get(name, "ReadAndWrite") == "ReadAndWrite"
):
match = variable_pattern.match(value)
return match
return None
Expand Down