blob: b58ff113d44263f7978000b082b926c0c0788d89 [file] [log] [blame]
Lewanczyk, Dawid88d16c92018-02-02 14:51:09 +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
18#include "node.hpp"
19
20namespace redfish {
21
22class AccountService : public Node {
23 public:
Borawski.Lukasz43a095a2018-02-19 15:39:01 +010024 template <typename CrowApp>
25 AccountService(CrowApp& app)
Ed Tanous3ebd75f2018-03-05 18:20:01 -080026 : Node(app,
Lewanczyk, Dawid88d16c92018-02-02 14:51:09 +010027 "/redfish/v1/AccountService/") {
Borawski.Lukaszc1a46bd2018-02-08 13:31:59 +010028 Node::json["@odata.id"] = "/redfish/v1/AccountService";
29 Node::json["@odata.type"] = "#AccountService.v1_1_0.AccountService";
30 Node::json["@odata.context"] =
Lewanczyk, Dawid88d16c92018-02-02 14:51:09 +010031 "/redfish/v1/$metadata#AccountService.AccountService";
Borawski.Lukaszc1a46bd2018-02-08 13:31:59 +010032 Node::json["Id"] = "AccountService";
33 Node::json["Description"] = "BMC User Accounts";
34 Node::json["Name"] = "Account Service";
35 Node::json["Status"]["State"] = "Enabled";
36 Node::json["Status"]["Health"] = "OK";
37 Node::json["Status"]["HealthRollup"] = "OK";
38 Node::json["ServiceEnabled"] = true;
39 Node::json["MinPasswordLength"] = 1;
40 Node::json["MaxPasswordLength"] = 20;
41 Node::json["Accounts"]["@odata.id"] = "/redfish/v1/AccountService/Accounts";
42 Node::json["Roles"]["@odata.id"] = "/redfish/v1/AccountService/Roles";
Ed Tanous3ebd75f2018-03-05 18:20:01 -080043
44 entityPrivileges = {
45 {crow::HTTPMethod::GET, {{"ConfigureUsers"}, {"ConfigureManager"}}},
46 {crow::HTTPMethod::HEAD, {{"Login"}}},
47 {crow::HTTPMethod::PATCH, {{"ConfigureUsers"}}},
48 {crow::HTTPMethod::PUT, {{"ConfigureUsers"}}},
49 {crow::HTTPMethod::DELETE, {{"ConfigureUsers"}}},
50 {crow::HTTPMethod::POST, {{"ConfigureUsers"}}}};
Lewanczyk, Dawid88d16c92018-02-02 14:51:09 +010051 }
52
53 private:
54 void doGet(crow::response& res, const crow::request& req,
55 const std::vector<std::string>& params) override {
Borawski.Lukaszc1a46bd2018-02-08 13:31:59 +010056 res.json_value = Node::json;
Lewanczyk, Dawid88d16c92018-02-02 14:51:09 +010057 res.end();
58 }
Lewanczyk, Dawid88d16c92018-02-02 14:51:09 +010059};
60
61} // namespace redfish