Skip to content

Commit

Permalink
Remove redundant obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
lauckhart committed Nov 24, 2024
1 parent 7d4e240 commit 74ff494
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions packages/node/src/behaviors/access-control/AccessControlServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,45 +243,6 @@ export class AccessControlServer extends AccessControlBehavior {
for (const change of computeAclChanges(actor, oldValue, value)) {
this.events.accessControlExtensionChanged.emit(change, this.context);
}
const { session } = this.context;

// TODO: This might be not really correct for local ACL changes because there the session fabric could be
// different which would lead to missing events of the relevant entries
const relevantFabricIndex = session?.associatedFabric.fabricIndex;

if (relevantFabricIndex === undefined || this.events.accessControlExtensionChanged === undefined) {
return;
}
const adminPasscodeId = session === undefined || session?.isPase ? 0 : null;
const adminNodeId = adminPasscodeId === null ? session?.associatedFabric.rootNodeId : null;
if (adminNodeId === undefined) {
// Should never happen
return;
}

const fabricExtensions = value.filter(entry => entry.fabricIndex === relevantFabricIndex);
const oldFabricExtensions = oldValue.filter(entry => entry.fabricIndex === relevantFabricIndex);

const changeType =
fabricExtensions.length > oldFabricExtensions.length
? AccessControlTypes.ChangeType.Added
: fabricExtensions.length < oldFabricExtensions.length
? AccessControlTypes.ChangeType.Removed
: AccessControlTypes.ChangeType.Changed;

this.events.accessControlExtensionChanged.emit(
{
changeType,
adminNodeId,
adminPasscodeId,
latestValue:
(changeType === AccessControlTypes.ChangeType.Removed
? oldFabricExtensions[0]
: fabricExtensions[0]) ?? null,
fabricIndex: relevantFabricIndex,
},
this.context,
);
}

/**
Expand Down

0 comments on commit 74ff494

Please sign in to comment.