Skip to content

DOS-879: Add ability to Permission Scripts#4405

Open
AnasAmil1 wants to merge 8 commits intodevelopmentfrom
fix/permissionScript
Open

DOS-879: Add ability to Permission Scripts#4405
AnasAmil1 wants to merge 8 commits intodevelopmentfrom
fix/permissionScript

Conversation

@AnasAmil1
Copy link
Copy Markdown
Collaborator

No description provided.

@AnasAmil1 AnasAmil1 changed the title Fix/permission script DOS-879: Add ability to Permission Scripts Sep 25, 2025
Comment thread src/foam/core/reflow/services.jrl Outdated

p({
"class": "foam.core.boot.CSpec",
"name": "libDAO",
Copy link
Copy Markdown
Collaborator

@jlhughes jlhughes Sep 25, 2025

Choose a reason for hiding this comment

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

Why is this called 'libDAO' when it stores reflow scripts?
This is not intuitive and not consistent with the rest of FOAM.

The Script model, when used elsewhere was extended - Cron, Test,
Realize that's not happening here, but perhaps the dao can be reflowScriptDAO.

Copy link
Copy Markdown
Collaborator Author

@AnasAmil1 AnasAmil1 Sep 25, 2025

Choose a reason for hiding this comment

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

it was a request from Kevin to name it libDAO

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We didn't want to name it scriptDAO because we already have the CORE scriptDAO, which is something different. The idea is that we don't want to have most of our end-users be able to write FLOW Scripts, but we do want to let them run them. So rather than embedding them inside FLOWs, we'll make a separate DAO of library functions, which they can run, hence the libDAO. This separates the ability to create or edit Library Scripts, from the ability to run them.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@AnasAmil1 Can you rename this to reflowLibDAO?

ret
.then(v => {
this.log(v);
try { this.notify && this.notify(`Script${this.scriptName ? ' "' + this.scriptName + '"' : ''} executed successfully`); } catch (e) {}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why do this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kgrgreer Just wanted to add some feedback: when I tried it, there was no way to tell if the script had run.

Comment thread src/foam/core/reflow/cmd/Commands.js Outdated
try {
// Try exact match on scriptName field
const result = await this.reflowLibDAO
.where(this.EQ(foam.core.reflow.Script.SCRIPT_NAME, scriptName))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can do find() instead of limit(1).select().

function run() {
let self = this;
with ( this.scope ) {
var _scope = this.scope || {};
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why have _scope?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because when i hit run from flow, scope returns undefined

Comment thread src/foam/core/reflow/Script.js
@@ -0,0 +1,30 @@
/**
* @license
* Copyright 2015 The FOAM Authors. All Rights Reserved.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

2025

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.

3 participants