blob: 43c48c2b57d05884f10dc3a448fa08efc606ad54 [file] [log] [blame]
Borawski.Lukasz86e1b662018-01-19 14:22:14 +01001/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16#pragma once
17
18namespace redfish {
19
20/**
21 * @brief Class used to store privileges for a given user.
22 */
23class UserPrivileges {
24 // TODO: Temporary stub, implementation will come with next patch-sets
25 private:
26 uint32_t redfishPrivileges;
27 uint32_t oemPrivileges;
28};
29
30/**
31 * @brief Class used to store privileges for a given Redfish entity.
32 */
33class EntityPrivileges {
34 // TODO: Temporary stub, implementation will come with next patch-sets
35 public:
36 bool isMethodAllowed(const crow::HTTPMethod& method,
37 const std::string& username) const {
38 return true;
39 }
40};
41
42/**
43 * @brief Class used to:
44 * - read the PrivilegeRegistry file,
45 * - provide EntityPrivileges objects to callers.
46 *
47 * To save runtime memory object of this class should
48 * exist only for the time required to install all Nodes.
49 */
50class PrivilegeProvider {
51 // TODO: Temporary stub, implementation will come with next patch-sets
52 public:
53 PrivilegeProvider() {
54 // load privilege_registry.json to memory
55 }
56
57 EntityPrivileges getPrivileges(const std::string &entity_url,
58 const std::string &entity_type) const {
59 // return an entity privilege object based on the privilege_registry.json,
60 // currently returning default constructed object
61 return EntityPrivileges();
62 }
63};
64
65} // namespace redfish
66