Skip to content

Commit

Permalink
update addWinsSetWithACL blueprint
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnotchung committed Dec 30, 2024
1 parent d196764 commit c03a472
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions packages/blueprints/src/AddWinsSetWithACL/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,15 @@ export class AddWinsSetWithACL<T> implements DRP {
if (!this.state.get(value)) this.state.set(value, true);
}

add(sender: string, value: T): void {
if (this.acl && !this.acl.isWriter(sender)) {
throw new Error("Only writers can add values.");
}
add(value: T): void {
this._add(value);
}

private _remove(value: T): void {
if (this.state.get(value)) this.state.set(value, false);
}

remove(sender: string, value: T): void {
if (this.acl && !this.acl.isWriter(sender)) {
throw new Error("Only writers can remove values.");
}
remove(value: T): void {
this._remove(value);
}

Expand Down

0 comments on commit c03a472

Please sign in to comment.