Commit b3b73956 authored by Nikola Hardi's avatar Nikola Hardi Committed by Nikola Hardi
Browse files

Improvements related to TJAlien::GetUser()

parent 5049a66c
......@@ -248,6 +248,8 @@ void TJAlien::MakeWebsocketConnection(std::string certpath, std::string keypath)
}
}
fUser = Whoami();
return;
}
......@@ -649,6 +651,9 @@ TGridResult *TJAlien::Command(const char *command, bool interactive, UInt_t stre
delete tokens;
delete sCmd;
TObjString p("user");
fUser = result->GetMetaData(&p)->GetString().Data();
return result;
}
......@@ -1728,6 +1733,18 @@ int TJAlien::ws_service_callback(struct lws *wsi, enum lws_callback_reasons reas
return 0;
}
const char* TJAlien::Whoami() {
TJAlienResult* r = (TJAlienResult*)Command("whoami");
const char *username;
if(r && (username = r->GetKey(0, "message"))) {
return username;
} else {
Error("TJAlien", "Unable to determine username.");
return "";
}
}
//______________________________________________________________________________
void TJAlien::NotImplemented(const char *func, const char *file, int line)
{
......
......@@ -131,6 +131,7 @@ private:
static int websocket_write_back(struct lws *wsi_in, const char *str, int str_size_in);
virtual TGridResult *OpenDataset(const char *lfn, const char *options = "");
const char* Whoami();
public:
TJAlien(const char *gridUrl, const char *uId=0, const char *passwd=0,
......@@ -140,6 +141,7 @@ public:
TJAlienResult *RunJsonCommand(TString *command, TList *options);
TGridResult *Command(const char * command, bool interactive = kFALSE, UInt_t stream = kOUTPUT);
Int_t GetExitCode(TJAlienResult *result, TObjString* &message);
unsigned int ReadTags(int column, std::map<std::string, std::string> &tags) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment