Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RemoveFabric to AccessControl #16685

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/access/AccessControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@ CHIP_ERROR AccessControl::Finish()
return retval;
}

CHIP_ERROR AccessControl::RemoveFabric(FabricIndex fabricIndex)
{
ChipLogProgress(DataManagement, "AccessControl: removing fabric %u", fabricIndex);

CHIP_ERROR err;
do
{
err = DeleteEntry(0, &fabricIndex);
} while (err == CHIP_NO_ERROR);

// Sentinel error is OK, just means there was no such entry.
ReturnErrorCodeIf(err != CHIP_ERROR_SENTINEL, err);

return CHIP_NO_ERROR;
}

CHIP_ERROR AccessControl::Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath,
Privilege requestPrivilege)
{
Expand Down
2 changes: 2 additions & 0 deletions src/access/AccessControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ class AccessControl
return mDelegate->DeleteEntry(index, fabricIndex);
}

CHIP_ERROR RemoveFabric(FabricIndex fabricIndex);

/**
* Iterates over entries in the access control list.
*
Expand Down
1 change: 1 addition & 0 deletions src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class Server
{
groupDataProvider->RemoveFabric(fabricIndex);
}
Access::GetAccessControl().RemoveFabric(fabricIndex);
};
void OnFabricRetrievedFromStorage(FabricInfo * fabricInfo) override { (void) fabricInfo; }

Expand Down