Skip to content

Commit

Permalink
Support remove fabric for access control extension
Browse files Browse the repository at this point in the history
Extension attribute needs its fabric scoped data removed
when the fabric is removed.

Part of issue project-chip#10252
  • Loading branch information
mlepage-google committed Apr 5, 2022
1 parent 01aa957 commit 7647d96
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/clusters/access-control-server/access-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,27 @@ CHIP_ERROR AccessControlAttribute::WriteExtension(AttributeValueDecoder & aDecod

AccessControlAttribute gAttribute;

class : public FabricTableDelegate
{
public:
void OnFabricDeletedFromStorage(CompressedFabricId compressedId, FabricIndex fabricIndex) override
{
auto & storage = Server::GetInstance().GetPersistentStorage();
DefaultStorageKeyAllocator key;
storage.SyncDeleteKeyValue(key.AccessControlExtensionEntry(fabricIndex));
}
void OnFabricRetrievedFromStorage(FabricInfo * fabricInfo) override {}
void OnFabricPersistedToStorage(FabricInfo * fabricInfo) override {}

} fabricTableDelegate;

} // namespace

void MatterAccessControlPluginServerInitCallback()
{
ChipLogProgress(DataManagement, "AccessControlCluster: initializing");

registerAttributeAccessOverride(&gAttribute);

Server::GetInstance().GetFabricTable().AddFabricDelegate(&fabricTableDelegate);
}

0 comments on commit 7647d96

Please sign in to comment.