diff --git a/build/tester-basicserver.cpp b/build/tester-basicserver.cpp index cf3b501..91285ba 100644 --- a/build/tester-basicserver.cpp +++ b/build/tester-basicserver.cpp @@ -892,7 +892,7 @@ class AuthFixture { static constexpr const char* prop_val {"RESPECT"}; public: - AuthFixture() { + AuthFixture() { // creati int make_result {create_table(addr, table)}; cerr << "create result " << make_result << endl; if (make_result != status_codes::Created && make_result != status_codes::Accepted) { diff --git a/src/AuthServer.cpp b/src/AuthServer.cpp index c1ee405..3a3b4b4 100644 --- a/src/AuthServer.cpp +++ b/src/AuthServer.cpp @@ -225,11 +225,7 @@ void handle_get(http_request message) { } // [0] refers to the operation name // Evaluated after size() to ensure legitimate access - else if(paths[0] == get_update_token_op) { - message.reply(status_codes::NotImplemented); - return; - } - else if(paths[0] != get_read_token_op) { + else if(paths[0] != get_read_token_op && paths[0] != get_update_token_op) { message.reply(status_codes::BadRequest); return; } @@ -330,13 +326,26 @@ void handle_get(http_request message) { return; } - pair result = do_get_token + // get a read or read|update token + pair result; + if(paths[0] == get_read_token_op) { + result = do_get_token ( table, authenticated_partition, authenticated_row, table_shared_access_policy::permissions::read ); + } + else { + result = do_get_token + ( + table, + authenticated_partition, + authenticated_row, + table_shared_access_policy::permissions::read | table_shared_access_policy::permissions::update + ); + } if(result.first == status_codes::OK) { vector> json_token; diff --git a/src/BasicServer.cpp b/src/BasicServer.cpp index e8c8247..aea7a20 100644 --- a/src/BasicServer.cpp +++ b/src/BasicServer.cpp @@ -465,7 +465,16 @@ void handle_put(http_request message) { else if(paths[0] == "AddPropertyAdmin" || paths[0] == "UpdatePropertyAdmin"){ message.reply(status_codes::NotImplemented); return; - } + } + else if(paths[0] == update_entity_auth){ + unordered_map json_body {get_json_bourne (message)}; + message.reply(update_with_token (message, tables_endpoint, json_body)); + return; + } + else if(paths[0] == add_property_admin || paths[0] == update_property_admin) { + message.reply(status_codes::NotImplemented); + return; + } else if (paths[0] != update_entity_admin) { message.reply(status_codes::BadRequest); return; @@ -492,6 +501,7 @@ void handle_put(http_request message) { table_result op_result {table.execute(operation)}; message.reply(status_codes::OK); + return; } /*