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: 24 template <typename CrowApp> 25 AccountService(CrowApp& app) : Node(app, "/redfish/v1/AccountService/") { 26 Node::json["@odata.id"] = "/redfish/v1/AccountService"; 27 Node::json["@odata.type"] = "#AccountService.v1_1_0.AccountService"; 28 Node::json["@odata.context"] = 29 "/redfish/v1/$metadata#AccountService.AccountService"; 30 Node::json["Id"] = "AccountService"; 31 Node::json["Description"] = "BMC User Accounts"; 32 Node::json["Name"] = "Account Service"; 33 Node::json["ServiceEnabled"] = true; 34 Node::json["MinPasswordLength"] = 1; 35 Node::json["MaxPasswordLength"] = 20; 36 Node::json["Accounts"]["@odata.id"] = "/redfish/v1/AccountService/Accounts"; 37 Node::json["Roles"]["@odata.id"] = "/redfish/v1/AccountService/Roles"; 38 39 entityPrivileges = { 40 {crow::HTTPMethod::GET, {{"ConfigureUsers"}, {"ConfigureManager"}}}, 41 {crow::HTTPMethod::HEAD, {{"Login"}}}, 42 {crow::HTTPMethod::PATCH, {{"ConfigureUsers"}}}, 43 {crow::HTTPMethod::PUT, {{"ConfigureUsers"}}}, 44 {crow::HTTPMethod::DELETE, {{"ConfigureUsers"}}}, 45 {crow::HTTPMethod::POST, {{"ConfigureUsers"}}}}; 46 } 47 48 private: 49 void doGet(crow::response& res, const crow::request& req, 50 const std::vector<std::string>& params) override { 51 res.json_value = Node::json; 52 res.end(); 53 } 54 }; 55 56 } // namespace redfish 57