Privilege implementation change
- privilege_registry.json has been removed
- PrivilegeProvider class has been removed
- default privileges for nodes are now hard-coded
- privilege overriding feature is not yet implemented
Change-Id: Ic9fdfa1c692c1abd26e339e2a8c702fc4aebd19f
Signed-off-by: Borawski.Lukasz <lukasz.borawski@intel.com>
diff --git a/redfish-core/lib/roles.hpp b/redfish-core/lib/roles.hpp
index d912e88..6a3c0d7 100644
--- a/redfish-core/lib/roles.hpp
+++ b/redfish-core/lib/roles.hpp
@@ -15,16 +15,31 @@
*/
#pragma once
-#include <vector>
#include "node.hpp"
namespace redfish {
+static OperationMap roleOpMap = {
+ {crow::HTTPMethod::GET, {{"Login"}}},
+ {crow::HTTPMethod::HEAD, {{"Login"}}},
+ {crow::HTTPMethod::PATCH, {{"ConfigureManager"}}},
+ {crow::HTTPMethod::PUT, {{"ConfigureManager"}}},
+ {crow::HTTPMethod::DELETE, {{"ConfigureManager"}}},
+ {crow::HTTPMethod::POST, {{"ConfigureManager"}}}};
+
+static OperationMap roleCollectionOpMap = {
+ {crow::HTTPMethod::GET, {{"Login"}}},
+ {crow::HTTPMethod::HEAD, {{"Login"}}},
+ {crow::HTTPMethod::PATCH, {{"ConfigureManager"}}},
+ {crow::HTTPMethod::PUT, {{"ConfigureManager"}}},
+ {crow::HTTPMethod::DELETE, {{"ConfigureManager"}}},
+ {crow::HTTPMethod::POST, {{"ConfigureManager"}}}};
+
class Roles : public Node {
public:
- template <typename CrowApp, typename PrivilegeProvider>
- Roles(CrowApp& app, PrivilegeProvider& provider)
- : Node(app, provider, "#Role.v1_0_2.Role",
+ template <typename CrowApp>
+ Roles(CrowApp& app)
+ : Node(app, EntityPrivileges(std::move(roleOpMap)),
"/redfish/v1/AccountService/Roles/Administrator/") {
nodeJson["@odata.id"] = "/redfish/v1/AccountService/Roles/Administrator";
nodeJson["@odata.type"] = "#Role.v1_0_2.Role";
@@ -51,9 +66,9 @@
class RoleCollection : public Node {
public:
- template <typename CrowApp, typename PrivilegeProvider>
- RoleCollection(CrowApp& app, PrivilegeProvider& provider)
- : Node(app, provider, "#RoleCollection.RoleCollection",
+ template <typename CrowApp>
+ RoleCollection(CrowApp& app)
+ : Node(app, EntityPrivileges(std::move(roleCollectionOpMap)),
"/redfish/v1/AccountService/Roles/") {
nodeJson["@odata.id"] = "/redfish/v1/AccountService/Roles";
nodeJson["@odata.type"] = "#RoleCollection.RoleCollection";