Skip to content

Commit

Permalink
Merge branch 'master' into int-Get-auth-and-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CtrlShiftGo committed Mar 31, 2016
2 parents 7d6c3d9 + 6a333b4 commit ca490ac
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build/tester-basicserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
21 changes: 15 additions & 6 deletions src/AuthServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -330,13 +326,26 @@ void handle_get(http_request message) {
return;
}

pair<status_code, string> result = do_get_token
// get a read or read|update token
pair<status_code, string> 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<pair<string, value>> json_token;
Expand Down
12 changes: 11 additions & 1 deletion src/BasicServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string,string> 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;
Expand All @@ -492,6 +501,7 @@ void handle_put(http_request message) {
table_result op_result {table.execute(operation)};

message.reply(status_codes::OK);
return;
}

/*
Expand Down

0 comments on commit ca490ac

Please sign in to comment.