Skip to content

Commit

Permalink
Support remove fabric for access control extension (project-chip#17032)
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 authored and chencheung committed Apr 6, 2022
1 parent c68dbc5 commit 784f01f
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 @@ -705,9 +705,27 @@ CHIP_ERROR AccessControlAttribute::WriteExtension(const ConcreteDataAttributePat

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 784f01f

Please sign in to comment.