Lewanczyk, Dawid | 88d16c9 | 2018-02-02 14:51:09 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 18 | #include "node.hpp" |
| 19 | |
| 20 | namespace redfish { |
| 21 | |
| 22 | class AccountService : public Node { |
| 23 | public: |
Ed Tanous | 6c23301 | 2018-03-15 14:43:56 -0700 | [diff] [blame] | 24 | AccountService(CrowApp& app) : Node(app, "/redfish/v1/AccountService/") { |
Borawski.Lukasz | c1a46bd | 2018-02-08 13:31:59 +0100 | [diff] [blame] | 25 | Node::json["@odata.id"] = "/redfish/v1/AccountService"; |
| 26 | Node::json["@odata.type"] = "#AccountService.v1_1_0.AccountService"; |
| 27 | Node::json["@odata.context"] = |
Lewanczyk, Dawid | 88d16c9 | 2018-02-02 14:51:09 +0100 | [diff] [blame] | 28 | "/redfish/v1/$metadata#AccountService.AccountService"; |
Borawski.Lukasz | c1a46bd | 2018-02-08 13:31:59 +0100 | [diff] [blame] | 29 | Node::json["Id"] = "AccountService"; |
| 30 | Node::json["Description"] = "BMC User Accounts"; |
| 31 | Node::json["Name"] = "Account Service"; |
Borawski.Lukasz | c1a46bd | 2018-02-08 13:31:59 +0100 | [diff] [blame] | 32 | Node::json["ServiceEnabled"] = true; |
| 33 | Node::json["MinPasswordLength"] = 1; |
| 34 | Node::json["MaxPasswordLength"] = 20; |
| 35 | Node::json["Accounts"]["@odata.id"] = "/redfish/v1/AccountService/Accounts"; |
| 36 | Node::json["Roles"]["@odata.id"] = "/redfish/v1/AccountService/Roles"; |
Ed Tanous | 3ebd75f | 2018-03-05 18:20:01 -0800 | [diff] [blame] | 37 | |
| 38 | entityPrivileges = { |
Borawski.Lukasz | 4b1b868 | 2018-04-04 12:50:16 +0200 | [diff] [blame] | 39 | {boost::beast::http::verb::get, |
| 40 | {{"ConfigureUsers"}, {"ConfigureManager"}}}, |
Ed Tanous | e0d918b | 2018-03-27 17:41:04 -0700 | [diff] [blame] | 41 | {boost::beast::http::verb::head, {{"Login"}}}, |
| 42 | {boost::beast::http::verb::patch, {{"ConfigureUsers"}}}, |
| 43 | {boost::beast::http::verb::put, {{"ConfigureUsers"}}}, |
| 44 | {boost::beast::http::verb::delete_, {{"ConfigureUsers"}}}, |
| 45 | {boost::beast::http::verb::post, {{"ConfigureUsers"}}}}; |
Lewanczyk, Dawid | 88d16c9 | 2018-02-02 14:51:09 +0100 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | private: |
Ed Tanous | 55c7b7a | 2018-05-22 15:27:24 -0700 | [diff] [blame^] | 49 | void doGet(crow::Response& res, const crow::Request& req, |
Lewanczyk, Dawid | 88d16c9 | 2018-02-02 14:51:09 +0100 | [diff] [blame] | 50 | const std::vector<std::string>& params) override { |
Ed Tanous | 55c7b7a | 2018-05-22 15:27:24 -0700 | [diff] [blame^] | 51 | res.jsonValue = Node::json; |
Lewanczyk, Dawid | 88d16c9 | 2018-02-02 14:51:09 +0100 | [diff] [blame] | 52 | res.end(); |
| 53 | } |
Lewanczyk, Dawid | 88d16c9 | 2018-02-02 14:51:09 +0100 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | } // namespace redfish |