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 authored and woody-apple committed Apr 5, 2022
1 parent 913aca0 commit 7c64305
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 7c64305

Please sign in to comment.