Skip to content

Commit

Permalink
fix: missing create(...) E_PERMs
Browse files Browse the repository at this point in the history
  • Loading branch information
abesto authored and rdaum committed Feb 23, 2025
1 parent 376d105 commit 463c348
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 53 deletions.
20 changes: 8 additions & 12 deletions crates/db/src/db_worldstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,14 @@ impl<TX: WorldStateTransaction> WorldState for DbTxWorldState<TX> {
owner: &Obj,
flags: BitEnum<ObjFlag>,
) -> Result<Obj, WorldStateError> {
/*
if ((valid(parent) ? !db_object_allows(parent, progr, FLAG_FERTILE)
: (parent != NOTHING)) || (owner != progr && !is_wizard(progr)))
return make_error_pack(E_PERM);
bool pe;
if (valid(parent)) {
pe = !db_object_allows(parent, progr, FLAG_FERTILE)
} else {
pe = (parent != NOTHING)) || (owner != progr && !is_wizard(progr)))
}
*/
let is_wizard = self.perms(perms)?.check_is_wizard()?;
if !self.valid(parent)? && (!parent.is_nothing() || (owner != perms && !is_wizard)) {
return Err(WorldStateError::ObjectPermissionDenied);
}

if !is_wizard && owner != perms {
return Err(WorldStateError::ObjectPermissionDenied);
}

self.check_parent(perms, parent, owner)?;

Expand Down
40 changes: 0 additions & 40 deletions crates/kernel/testsuite/moot/translate.awk

This file was deleted.

2 changes: 1 addition & 1 deletion crates/kernel/testsuite/moot_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,5 @@ fn test(db: Box<dyn Database>, path: &Path) {
fn test_single() {
// cargo test -p moor-kernel --test moot-suite test_single -- --ignored
// CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --test moot-suite -- test_single --ignored
test_with_db(&testsuite_dir().join("moot/objects/test_create.moot"));
test_with_db(&testsuite_dir().join("moot/objects/test_create_errors.moot"));
}

0 comments on commit 463c348

Please sign in to comment.