xref: /openbmc/bmcweb/features/redfish/lib/account_service.hpp (revision 1abe55ef9844afcddcab9d862ae06118f3a2390c)
188d16c9aSLewanczyk, Dawid /*
288d16c9aSLewanczyk, Dawid // Copyright (c) 2018 Intel Corporation
388d16c9aSLewanczyk, Dawid //
488d16c9aSLewanczyk, Dawid // Licensed under the Apache License, Version 2.0 (the "License");
588d16c9aSLewanczyk, Dawid // you may not use this file except in compliance with the License.
688d16c9aSLewanczyk, Dawid // You may obtain a copy of the License at
788d16c9aSLewanczyk, Dawid //
888d16c9aSLewanczyk, Dawid //      http://www.apache.org/licenses/LICENSE-2.0
988d16c9aSLewanczyk, Dawid //
1088d16c9aSLewanczyk, Dawid // Unless required by applicable law or agreed to in writing, software
1188d16c9aSLewanczyk, Dawid // distributed under the License is distributed on an "AS IS" BASIS,
1288d16c9aSLewanczyk, Dawid // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1388d16c9aSLewanczyk, Dawid // See the License for the specific language governing permissions and
1488d16c9aSLewanczyk, Dawid // limitations under the License.
1588d16c9aSLewanczyk, Dawid */
1688d16c9aSLewanczyk, Dawid #pragma once
1788d16c9aSLewanczyk, Dawid 
1888d16c9aSLewanczyk, Dawid #include "node.hpp"
1988d16c9aSLewanczyk, Dawid 
20*1abe55efSEd Tanous namespace redfish
21*1abe55efSEd Tanous {
2288d16c9aSLewanczyk, Dawid 
23*1abe55efSEd Tanous class AccountService : public Node
24*1abe55efSEd Tanous {
2588d16c9aSLewanczyk, Dawid   public:
26*1abe55efSEd Tanous     AccountService(CrowApp& app) : Node(app, "/redfish/v1/AccountService/")
27*1abe55efSEd Tanous     {
28c1a46bd2SBorawski.Lukasz         Node::json["@odata.id"] = "/redfish/v1/AccountService";
29c1a46bd2SBorawski.Lukasz         Node::json["@odata.type"] = "#AccountService.v1_1_0.AccountService";
30c1a46bd2SBorawski.Lukasz         Node::json["@odata.context"] =
3188d16c9aSLewanczyk, Dawid             "/redfish/v1/$metadata#AccountService.AccountService";
32c1a46bd2SBorawski.Lukasz         Node::json["Id"] = "AccountService";
33c1a46bd2SBorawski.Lukasz         Node::json["Description"] = "BMC User Accounts";
34c1a46bd2SBorawski.Lukasz         Node::json["Name"] = "Account Service";
35c1a46bd2SBorawski.Lukasz         Node::json["ServiceEnabled"] = true;
36c1a46bd2SBorawski.Lukasz         Node::json["MinPasswordLength"] = 1;
37c1a46bd2SBorawski.Lukasz         Node::json["MaxPasswordLength"] = 20;
38*1abe55efSEd Tanous         Node::json["Accounts"]["@odata.id"] =
39*1abe55efSEd Tanous             "/redfish/v1/AccountService/Accounts";
40c1a46bd2SBorawski.Lukasz         Node::json["Roles"]["@odata.id"] = "/redfish/v1/AccountService/Roles";
413ebd75f7SEd Tanous 
423ebd75f7SEd Tanous         entityPrivileges = {
434b1b8683SBorawski.Lukasz             {boost::beast::http::verb::get,
444b1b8683SBorawski.Lukasz              {{"ConfigureUsers"}, {"ConfigureManager"}}},
45e0d918bcSEd Tanous             {boost::beast::http::verb::head, {{"Login"}}},
46e0d918bcSEd Tanous             {boost::beast::http::verb::patch, {{"ConfigureUsers"}}},
47e0d918bcSEd Tanous             {boost::beast::http::verb::put, {{"ConfigureUsers"}}},
48e0d918bcSEd Tanous             {boost::beast::http::verb::delete_, {{"ConfigureUsers"}}},
49e0d918bcSEd Tanous             {boost::beast::http::verb::post, {{"ConfigureUsers"}}}};
5088d16c9aSLewanczyk, Dawid     }
5188d16c9aSLewanczyk, Dawid 
5288d16c9aSLewanczyk, Dawid   private:
5355c7b7a2SEd Tanous     void doGet(crow::Response& res, const crow::Request& req,
54*1abe55efSEd Tanous                const std::vector<std::string>& params) override
55*1abe55efSEd Tanous     {
5655c7b7a2SEd Tanous         res.jsonValue = Node::json;
5788d16c9aSLewanczyk, Dawid         res.end();
5888d16c9aSLewanczyk, Dawid     }
5988d16c9aSLewanczyk, Dawid };
6088d16c9aSLewanczyk, Dawid 
6188d16c9aSLewanczyk, Dawid } // namespace redfish
62