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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(access): add AccessControl #59

Merged
merged 10 commits into from
May 17, 2024
Merged

feat(access): add AccessControl #59

merged 10 commits into from
May 17, 2024

Conversation

alexfertel
Copy link
Contributor

@alexfertel alexfertel commented May 13, 2024

Fixes #13

PR Checklist

  • Tests
  • Documentation

@alexfertel alexfertel added priority: 2 We will resolve this in a short timeframe. type: feature New feature request. effort: medium Default level of effort. labels May 13, 2024
@alexfertel alexfertel self-assigned this May 13, 2024
Copy link

netlify bot commented May 13, 2024

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit 5a760c7
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/6645ccd0cbbed700083ded8d

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 90.35370% with 30 lines in your changes are missing coverage. Please review.

Project coverage is 84.4%. Comparing base (4f78b0d) to head (5a760c7).
Report is 2 commits behind head on main.

Additional details and impacted files
Files Coverage Δ
contracts/src/access/ownable.rs 89.5% <100.0%> (-0.3%) ⬇️
contracts/src/access/control.rs 90.2% <90.2%> (ø)

... and 2 files with indirect coverage changes

@alexfertel alexfertel changed the title feat(access): add events and errors for AccessControl feat(access): add AccessControl May 13, 2024
@alexfertel alexfertel requested review from bidzyyys and qalisander May 14, 2024 13:42
@alexfertel alexfertel added this to the Release v0.1.0 milestone May 14, 2024
@alexfertel alexfertel marked this pull request as ready for review May 14, 2024 13:42
bidzyyys
bidzyyys previously approved these changes May 15, 2024
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

Great job, everything clean and well-documented 👏
Left some minor comments about docs.

contracts/src/access/control.rs Show resolved Hide resolved
contracts/src/access/control.rs Outdated Show resolved Hide resolved
contracts/src/access/control.rs Outdated Show resolved Hide resolved
contracts/src/access/control.rs Outdated Show resolved Hide resolved
examples/access-control/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@qalisander qalisander left a comment

Choose a reason for hiding this comment

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

Looks good!
I'll try to give second pass review tomorrow.

@bidzyyys bidzyyys self-requested a review May 16, 2024 13:38
contracts/src/access/control.rs Show resolved Hide resolved
Copy link
Member

@qalisander qalisander left a comment

Choose a reason for hiding this comment

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

Good job!
Just one small comment

contract._roles.setter(ROLE.into()).has_role.insert(ALICE, true);

let has_role = contract.has_role(ROLE.into(), ALICE);
assert_eq!(has_role, true);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just have assert!(has_role); and in other locations also

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hehe, this is something Daniel also brought up.

I prefer assert_eq! because the terminal output is clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2024-05-17 at 16 25 37
Screenshot 2024-05-17 at 16 26 07

@alexfertel alexfertel merged commit 5fc6943 into main May 17, 2024
18 checks passed
@alexfertel alexfertel deleted the access-control branch May 17, 2024 14:27
@alexfertel alexfertel removed this from the Release v0.1.0 milestone Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium Default level of effort. priority: 2 We will resolve this in a short timeframe. type: feature New feature request.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Access Control
3 participants