Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2022 Project CHIP Authors
4 : * All rights reserved.
5 : *
6 : * Licensed under the Apache License, Version 2.0 (the "License");
7 : * you may not use this file except in compliance with the License.
8 : * You may obtain a copy of the License at
9 : *
10 : * http://www.apache.org/licenses/LICENSE-2.0
11 : *
12 : * Unless required by applicable law or agreed to in writing, software
13 : * distributed under the License is distributed on an "AS IS" BASIS,
14 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 : * See the License for the specific language governing permissions and
16 : * limitations under the License.
17 : */
18 :
19 : #include "PermissiveAccessControlDelegate.h"
20 :
21 : namespace {
22 :
23 : using namespace chip;
24 : using namespace chip::Access;
25 :
26 : using Entry = chip::Access::AccessControl::Entry;
27 : using EntryIterator = chip::Access::AccessControl::EntryIterator;
28 : using Target = Entry::Target;
29 :
30 : class AccessControlDelegate : public AccessControl::Delegate
31 : {
32 : public:
33 280 : CHIP_ERROR Init() override { return CHIP_NO_ERROR; }
34 280 : void Finish() override {}
35 :
36 : // Capabilities
37 0 : CHIP_ERROR GetMaxEntryCount(size_t & value) const override
38 : {
39 0 : value = 0;
40 0 : return CHIP_NO_ERROR;
41 : }
42 :
43 : // Actualities
44 0 : CHIP_ERROR GetEntryCount(size_t & value) const override
45 : {
46 0 : value = 0;
47 0 : return CHIP_NO_ERROR;
48 : }
49 :
50 : // Preparation
51 0 : CHIP_ERROR PrepareEntry(Entry & entry) override { return CHIP_NO_ERROR; }
52 :
53 : // CRUD
54 0 : CHIP_ERROR CreateEntry(size_t * index, const Entry & entry, FabricIndex * fabricIndex) override { return CHIP_NO_ERROR; }
55 0 : CHIP_ERROR ReadEntry(size_t index, Entry & entry, const FabricIndex * fabricIndex) const override { return CHIP_NO_ERROR; }
56 0 : CHIP_ERROR UpdateEntry(size_t index, const Entry & entry, const FabricIndex * fabricIndex) override { return CHIP_NO_ERROR; }
57 0 : CHIP_ERROR DeleteEntry(size_t index, const FabricIndex * fabricIndex) override { return CHIP_NO_ERROR; }
58 :
59 : // Iteration
60 0 : CHIP_ERROR Entries(EntryIterator & iterator, const FabricIndex * fabricIndex) const override { return CHIP_NO_ERROR; }
61 :
62 : // Check
63 8608 : CHIP_ERROR Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath,
64 : Privilege requestPrivilege) override
65 : {
66 8608 : return CHIP_NO_ERROR;
67 : }
68 : };
69 :
70 : } // namespace
71 :
72 : namespace chip {
73 : namespace Access {
74 : namespace Examples {
75 :
76 280 : AccessControl::Delegate * GetPermissiveAccessControlDelegate()
77 : {
78 280 : static AccessControlDelegate accessControlDelegate;
79 280 : return &accessControlDelegate;
80 : }
81 :
82 : } // namespace Examples
83 : } // namespace Access
84 : } // namespace chip
|