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

Refactor active to primary in RPC providers #41

Merged
merged 7 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only allow admins to modify providers
  • Loading branch information
rvanasa committed Sep 21, 2023
commit f0305a04725b61b5528e3451ba6110c44b9c3399
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -95,8 +95,12 @@ fn register_provider(provider: RegisterProvider) -> u64 {
fn update_provider(update: UpdateProvider) {
PROVIDERS.with(|p| match p.borrow_mut().get(&update.provider_id) {
Some(mut provider) => {
if provider.owner != ic_cdk::caller() && !is_authorized(Auth::Admin) {
ic_cdk::trap("Provider owner != caller");
let is_admin = is_authorized(Auth::Admin);
// if provider.owner != ic_cdk::caller() && !is_admin {
// ic_cdk::trap("Provider owner != caller");
// }
if !is_admin {
ic_cdk::trap("`update_provider` currently requires admin permissions")
}
if let Some(url) = update.base_url {
validate_base_url(&url);