Skip to content

Commit

Permalink
Remove weak MatterGetAccessPrivilegeForXX functions and add stubs for…
Browse files Browse the repository at this point in the history
… test-helper and chip-im-responder/initiator (#21220) (#21387)

Co-authored-by: Wang Qixiang <43193572+wqx6@users.noreply.github.com>
  • Loading branch information
woody-apple and wqx6 authored Jul 29, 2022
1 parent be72965 commit 079a65d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/app/RequiredPrivilege.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,3 @@ constexpr Access::Privilege RequiredPrivilege::kPrivilegeMapper[];

} // namespace app
} // namespace chip

int __attribute__((weak)) MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute)
{
return kMatterAccessPrivilegeAdminister;
}

int __attribute__((weak)) MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute)
{
return kMatterAccessPrivilegeAdminister;
}

int __attribute__((weak)) MatterGetAccessPrivilegeForInvokeCommand(chip::ClusterId cluster, chip::CommandId command)
{
return kMatterAccessPrivilegeAdminister;
}

int __attribute__((weak)) MatterGetAccessPrivilegeForReadEvent(chip::ClusterId cluster, chip::EventId event)
{
return kMatterAccessPrivilegeAdminister;
}
1 change: 1 addition & 0 deletions src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static_library("helpers") {
sources = [
"AppTestContext.cpp",
"AppTestContext.h",
"integration/RequiredPrivilegeStubs.cpp",
]

cflags = [ "-Wconversion" ]
Expand Down
2 changes: 2 additions & 0 deletions src/app/tests/integration/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ assert(chip_build_tools)

executable("chip-im-initiator") {
sources = [
"RequiredPrivilegeStubs.cpp",
"chip_im_initiator.cpp",
"common.cpp",
]
Expand All @@ -41,6 +42,7 @@ executable("chip-im-initiator") {
executable("chip-im-responder") {
sources = [
"MockEvents.cpp",
"RequiredPrivilegeStubs.cpp",
"chip_im_responder.cpp",
"common.cpp",
]
Expand Down
38 changes: 38 additions & 0 deletions src/app/tests/integration/RequiredPrivilegeStubs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <app/util/privilege-storage.h>

int MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute)
{
return kMatterAccessPrivilegeAdminister;
}

int MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute)
{
return kMatterAccessPrivilegeAdminister;
}

int MatterGetAccessPrivilegeForInvokeCommand(chip::ClusterId cluster, chip::CommandId command)
{
return kMatterAccessPrivilegeAdminister;
}

int MatterGetAccessPrivilegeForReadEvent(chip::ClusterId cluster, chip::EventId event)
{
return kMatterAccessPrivilegeAdminister;
}

0 comments on commit 079a65d

Please sign in to comment.