DOS-879: Add ability to Permission Scripts#4405
DOS-879: Add ability to Permission Scripts#4405AnasAmil1 wants to merge 8 commits intodevelopmentfrom
Conversation
|
|
||
| p({ | ||
| "class": "foam.core.boot.CSpec", | ||
| "name": "libDAO", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
it was a request from Kevin to name it libDAO
There was a problem hiding this comment.
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.
| ret | ||
| .then(v => { | ||
| this.log(v); | ||
| try { this.notify && this.notify(`Script${this.scriptName ? ' "' + this.scriptName + '"' : ''} executed successfully`); } catch (e) {} |
There was a problem hiding this comment.
@kgrgreer Just wanted to add some feedback: when I tried it, there was no way to tell if the script had run.
| try { | ||
| // Try exact match on scriptName field | ||
| const result = await this.reflowLibDAO | ||
| .where(this.EQ(foam.core.reflow.Script.SCRIPT_NAME, scriptName)) |
There was a problem hiding this comment.
Can do find() instead of limit(1).select().
| function run() { | ||
| let self = this; | ||
| with ( this.scope ) { | ||
| var _scope = this.scope || {}; |
There was a problem hiding this comment.
Because when i hit run from flow, scope returns undefined
| @@ -0,0 +1,30 @@ | |||
| /** | |||
| * @license | |||
| * Copyright 2015 The FOAM Authors. All Rights Reserved. | |||
No description provided.