diff options
author | Borawski.Lukasz <lukasz.borawski@intel.com> | 2018-02-19 17:39:01 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2018-03-28 00:02:27 +0300 |
commit | 43a095ab36b35bcb9192218fd11e0ff86ec63bf9 (patch) | |
tree | e2ab46502986b90a2bb3db100f6b525968cf693a /redfish-core/lib/redfish_sessions.hpp | |
parent | 88d16c9a01366cfcc4e675683a7e667da5d29924 (diff) | |
download | bmcweb-43a095ab36b35bcb9192218fd11e0ff86ec63bf9.tar.xz |
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>
Diffstat (limited to 'redfish-core/lib/redfish_sessions.hpp')
-rw-r--r-- | redfish-core/lib/redfish_sessions.hpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp index 11cde7234c..58d5b94912 100644 --- a/redfish-core/lib/redfish_sessions.hpp +++ b/redfish-core/lib/redfish_sessions.hpp @@ -14,19 +14,35 @@ // limitations under the License. */ #pragma once -#include <tuple> + #include "node.hpp" #include "session_storage_singleton.hpp" namespace redfish { +static OperationMap sessionOpMap = { + {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 sessionCollectionOpMap = { + {crow::HTTPMethod::GET, {{"Login"}}}, + {crow::HTTPMethod::HEAD, {{"Login"}}}, + {crow::HTTPMethod::PATCH, {{"ConfigureManager"}}}, + {crow::HTTPMethod::PUT, {{"ConfigureManager"}}}, + {crow::HTTPMethod::DELETE, {{"ConfigureManager"}}}, + {crow::HTTPMethod::POST, {{}}}}; + class SessionCollection; class Sessions : public Node { public: - template <typename CrowApp, typename PrivilegeProvider> - Sessions(CrowApp& app, PrivilegeProvider& provider) - : Node(app, provider, "#Session.v1_0_2.Session", + template <typename CrowApp> + Sessions(CrowApp& app) + : Node(app, EntityPrivileges(std::move(sessionOpMap)), "/redfish/v1/SessionService/Sessions/<str>", std::string()) { nodeJson["@odata.type"] = "#Session.v1_0_2.Session"; nodeJson["@odata.context"] = "/redfish/v1/$metadata#Session.Session"; @@ -90,11 +106,11 @@ class Sessions : public Node { class SessionCollection : public Node { public: - template <typename CrowApp, typename PrivilegeProvider> - SessionCollection(CrowApp& app, PrivilegeProvider& provider) - : Node(app, provider, "#SessionCollection.SessionCollection", + template <typename CrowApp> + SessionCollection(CrowApp& app) + : Node(app, EntityPrivileges(std::move(sessionCollectionOpMap)), "/redfish/v1/SessionService/Sessions/"), - memberSession(app, provider) { + memberSession(app) { nodeJson["@odata.type"] = "#SessionCollection.SessionCollection"; nodeJson["@odata.id"] = "/redfish/v1/SessionService/Sessions/"; nodeJson["@odata.context"] = @@ -127,7 +143,6 @@ class SessionCollection : public Node { const std::vector<std::string>& params) override { std::string username; bool userAuthSuccessful = authenticateUser(req, &res.code, &username); - if (!userAuthSuccessful) { res.end(); return; |