Skip to content

Commit

Permalink
feat(program): add simple access control
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop committed Feb 21, 2024
1 parent bc21a37 commit 73b757e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,24 @@ extern fn handle() {
// TODO:
//
// 1) format checks.
// 2) use domain instead of simple data source.
// 3) sub paths for this domain.
// 4) integration with identity interface.

// Just overriding the content atm.
state
let domain = state
.entry(payload.domain.clone())
.or_insert_with(|| Domain {
owner: sender,
paths: Default::default(),
})
.paths
.insert(payload.path, payload.src);
});

if domain.owner != sender {
// Do nothing atm.
//
// TODO: Returns the error to the client.
return;
}

domain.paths.insert(payload.path, payload.src);
}

// The `state()` entry point.
Expand Down

0 comments on commit 73b757e

Please sign in to comment.