Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,13 @@ declare namespace Stardog {
*/
function token(conn: Connection): Promise<HTTP.Body>;

/**
* Returns the username for the given connection.
*
* @param {Connection} conn the Stardog server connection
*/
function whoAmI(conn: Connection): Promise<HTTP.Body>;

interface Permission {
action: Action,
resourceType: ResourceType,
Expand Down
8 changes: 8 additions & 0 deletions lib/user/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ const token = conn => {
}).then(httpBody);
};

const whoAmI = conn => {
const headers = conn.headers();
return fetch(conn.request('admin', 'status', 'whoami'), {
headers,
}).then(httpBody);
};

module.exports = {
assignPermission,
changePassword,
Expand All @@ -188,4 +195,5 @@ module.exports = {
superUser,
token,
valid,
whoAmI,
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,9 @@
]
}
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5"
},
"stardog-version": ">=7.0.0"
}