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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor dao acl - #858 task #864

Merged
merged 3 commits into from
Nov 17, 2019
Merged

Refactor dao acl - #858 task #864

merged 3 commits into from
Nov 17, 2019

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Nov 2, 2019

馃 Pull Request

Subtask of #858. Separate the logic from the CLI front-end and test the logic part.

  • acl create command
  • acl grant command
  • acl remove-manager command
  • acl revoke command
  • acl set-manager command
  • acl view command

acl view:
Split the logic into three files / parts

  • lib/acl/view: Fetches the data and interfaces with aragon-js
[ "0xab1200000000000000000000000000000000cd34"  ]
  • lib/acl/viewFormatter: Parses the data and returns the data relevant to the user appended with human names. This component is fully tested
{ name: "acl", address: "0xab1200000000000000000000000000000000cd34" }
  • commands/dao/acl/view (original): Call data fetcher, call parser, and then print the data in as a table with emojis on other stringified content.
acl (0xab12...cd34)

Also, every used function is now typed with JSDoc, and the typings abstracted to typedef.js. I have seen that @macor161 also uses JSDoc on new code, can we create general type definitions for reused that structures such a module, network etc?

others:
All other dao acl commands just called the wrapper execHandler and since they do just one single asynchronous task there is no intermediate logging. If its logic was moved out to a lib/**/* file I'm not sure if it would just be code duplication. After further review, there are too many dependencies of these utils, so I can't safely refactor them at the moment. I would recommend considering the exclusive acl commands refactored and tackle the dao utils refactors latter.

馃毃 Test instructions

Run aragon dao acl commands against your DAO

鉁旓笍 PR Todo

  • Include links to related issues/PRs
  • Update unit tests for this change
  • Update the relevant documentation
  • Clear dependencies on other modules that have to be released before merging this

@dapplion dapplion changed the title Refactor dao acl view Refactor dao acl view - #858 task Nov 2, 2019
@dapplion dapplion mentioned this pull request Nov 2, 2019
5 tasks
@mcormier
Copy link

mcormier commented Nov 2, 2019

Hey. I was mentioned above but this project does not remind me of anything. Did I make a suggestion a long time ago that is now being considered or was the wrong person added in the description? Cheers.

@0xGabi
Copy link
Contributor

0xGabi commented Nov 3, 2019

Hi @mcormier sorry about that we have a team mate with a similar GitHub username

@dapplion
Copy link
Contributor Author

dapplion commented Nov 4, 2019

Yep, I mistaken you for @macor161. Thank you @0xGabi for amending the PR mentions.

Copy link
Contributor

@0xGabi 0xGabi left a comment

Choose a reason for hiding this comment

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

LGTM 馃檶

@macor161 can you double check the typedef files before we merge it.

I'll create an issue to track the abstraction options for the execHandler

0xGabi
0xGabi approved these changes Nov 5, 2019
@codecov
Copy link

codecov bot commented Nov 8, 2019

Codecov Report

Merging #864 into develop will increase coverage by 0.69%.
The diff coverage is 24.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop    #864      +/-   ##
==========================================
+ Coverage     7.13%   7.83%   +0.69%     
==========================================
  Files           89      91       +2     
  Lines         2423    2425       +2     
==========================================
+ Hits           173     190      +17     
+ Misses        2250    2235      -15
Impacted Files Coverage 螖
packages/aragon-cli/src/lib/acl/view.js 0% <0%> (酶)
...src/commands/dao_cmds/acl_cmds/utils/knownRoles.js 0% <0%> (酶) 猬嗭笍
.../aragon-cli/src/commands/dao_cmds/acl_cmds/view.js 0% <0%> (酶) 猬嗭笍
packages/aragon-cli/src/lib/acl/viewFormatter.js 100% <100%> (酶)

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 4d6e39c...3ee5fdd. Read the comment docs.

@dapplion
Copy link
Contributor Author

dapplion commented Nov 8, 2019

@0xGabi In reference to all acl commands except acl view:
I would recommend considering the acl commands refactored. The next step would be to address the helpers and utils they depend on. However, after further review, there are too many dependencies of these utils, so it's not safe refactor them at the moment. It would be best to address all dao helpers/utils at once.

@0xGabi 0xGabi self-requested a review November 8, 2019 18:31
@dapplion dapplion changed the title Refactor dao acl view - #858 task Refactor dao acl - #858 task Nov 9, 2019
Copy link
Contributor

@0xGabi 0xGabi left a comment

Choose a reason for hiding this comment

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

Made a small comments and suggest a little change to prevent an error when module is empty

Co-Authored-By: Gabriel Garcia <gabrielpk.18@gmail.com>
* @property {string[]} allowedEntities
* @property {string} manager
*
* ACL structure sample: {
Copy link
Contributor

Choose a reason for hiding this comment

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

@dapplion is this ACL structure sample complete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Until the PermissionsData level, I think so.

@0xGabi 0xGabi self-requested a review November 17, 2019 05:04
Copy link
Contributor

@0xGabi 0xGabi left a comment

Choose a reason for hiding this comment

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

After doing other review I consider this is ready to be merged. There are a few cosmetic changes that we can discuss on next sync.

We discuss with Mathew to merge the PR first and then he'll take a look.

@0xGabi 0xGabi merged commit 484a178 into aragon:develop Nov 17, 2019
@dapplion dapplion deleted the acl_refactor branch November 17, 2019 16:55
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.

None yet

4 participants