-
Notifications
You must be signed in to change notification settings - Fork 187
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
Support grant/revoke writer/owner #1572
Conversation
06ad0ca
to
86c60ce
Compare
86c60ce
to
6fee787
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1572 +/- ##
==========================================
- Coverage 70.66% 69.63% -1.04%
==========================================
Files 264 265 +1
Lines 25623 26298 +675
==========================================
+ Hits 18107 18313 +206
- Misses 7516 7985 +469 ☔ View full report in Codecov by Sentry. |
6fee787
to
60a1e58
Compare
} | ||
} | ||
}, | ||
_ => todo!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good first issue. :)
bin/sozo/src/commands/auth.rs
Outdated
let owner = FieldElement::from_hex_be(owner_part) | ||
.map_err(|_| anyhow::anyhow!("Invalid owner address: {}", owner_part))?; | ||
|
||
let resource_parts: Vec<&str> = resource_part.split(':').collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the resource can be contract:contract_name
, we're expecting the fully qualifier name of the contract or the short name? It will fail here if we have to pass the fully qualified name due to :
split.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, this would be an issue for fully qualified name.
We can use split_once
for this to capture the first occurrence of :
if we wanna maintain this format.
Considering most contract name would be fully qualified name, i think this format can cause a bit of confusion when user do something like contract:examples::action::action_1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm yeah good point. i was following the starkli schema pattern but perhaps we should do something difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking about this a bit more, i feel like it is ok. so going to plan to keep as is, unless you guys feel strongly about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, this is a needed feature so don't wanna block too much. We can always address it if it becomes an actual concern later.
impl FromStr for OwnerResource { | ||
type Err = anyhow::Error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much better, nice idea.
bin/sozo/src/commands/auth.rs
Outdated
let owner = FieldElement::from_hex_be(owner_part) | ||
.map_err(|_| anyhow::anyhow!("Invalid owner address: {}", owner_part))?; | ||
|
||
let resource_parts: Vec<&str> = resource_part.split(':').collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, this would be an issue for fully qualified name.
We can use split_once
for this to capture the first occurrence of :
if we wanna maintain this format.
Considering most contract name would be fully qualified name, i think this format can cause a bit of confusion when user do something like contract:examples::action::action_1
60a1e58
to
b424dcc
Compare
b424dcc
to
cf0a8de
Compare
Adds support for granting owners and setup for revoke commands.