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 transitional support to access control #12110

Merged
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
3 changes: 3 additions & 0 deletions src/access/AccessControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ CHIP_ERROR AccessControl::Finish()
CHIP_ERROR AccessControl::Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath,
Privilege requestPrivilege)
{
// During development, allow access if delegate is transitional
ReturnErrorCodeIf(mDelegate.IsTransitional(), CHIP_NO_ERROR);

EntryIterator iterator;
ReturnErrorOnFailure(Entries(iterator, &subjectDescriptor.fabricIndex));

Expand Down
3 changes: 3 additions & 0 deletions src/access/AccessControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ class AccessControl
return CHIP_ERROR_NOT_IMPLEMENTED;
}

// Transitional (during development, will be removed later)
virtual bool IsTransitional() const { return true; }

// Listening
virtual void SetListener(Listener & listener) { mListener = &listener; }
virtual void ClearListener() { mListener = nullptr; }
Expand Down
2 changes: 2 additions & 0 deletions src/access/examples/ExampleAccessControlDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,8 @@ class AccessControlDelegate : public AccessControl::Delegate
return CHIP_ERROR_BUFFER_TOO_SMALL;
}

bool IsTransitional() const override { return false; }

private:
CHIP_ERROR LoadFromFlash() { return CHIP_NO_ERROR; }

Expand Down