-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c97251a
commit 6ca1ee2
Showing
4 changed files
with
45 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,28 +7,28 @@ const g_lib = require("./support"); | |
module.exports = (function () { | ||
let obj = {}; | ||
|
||
/** | ||
* Checks if a client has the required permissions on a record. | ||
* | ||
* @param {object} a_client - A user document representing the client being verified. | ||
* @param {string} a_data_key - A DataFed key associated with a record (not prepended with 'd/'). | ||
* The client object should have the following structure: | ||
* | ||
* "_key": "bob", | ||
* "_id": "u/bob", | ||
* "name": "bob junior", | ||
* "name_first": "bob", | ||
* "name_last": "jones", | ||
* "is_admin": true, | ||
* "max_coll": 50, | ||
* "max_proj": 10, | ||
* "max_sav_qry": 20, | ||
* "email": "[email protected]" | ||
* | ||
* @param {string} a_perm - The permission type to check (e.g., `PERM_CREATE`, `PERM_WR_DATA`, `PERM_RD_DATA`). | ||
* | ||
* @returns {boolean} True if the client has the required permissions, otherwise false. | ||
*/ | ||
/** | ||
* Checks if a client has the required permissions on a record. | ||
* | ||
* @param {object} a_client - A user document representing the client being verified. | ||
* @param {string} a_data_key - A DataFed key associated with a record (not prepended with 'd/'). | ||
* The client object should have the following structure: | ||
* | ||
* "_key": "bob", | ||
* "_id": "u/bob", | ||
* "name": "bob junior", | ||
* "name_first": "bob", | ||
* "name_last": "jones", | ||
* "is_admin": true, | ||
* "max_coll": 50, | ||
* "max_proj": 10, | ||
* "max_sav_qry": 20, | ||
* "email": "[email protected]" | ||
* | ||
* @param {string} a_perm - The permission type to check (e.g., `PERM_CREATE`, `PERM_WR_DATA`, `PERM_RD_DATA`). | ||
* | ||
* @returns {boolean} True if the client has the required permissions, otherwise false. | ||
*/ | ||
obj.isRecordActionAuthorized = function (a_client, a_data_key, a_perm) { | ||
const data_id = "d/" + a_data_key; | ||
// If the user is not an admin of the object we will need | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -640,7 +640,7 @@ module.exports = (function () { | |
* Retrieves user information based on the provided client ID. | ||
* | ||
* The return value should be a client containing the following information: | ||
* | ||
* | ||
* "_key" : "bob", | ||
* "_id" : "u/bob", | ||
* "name" : "bob junior", | ||
|
@@ -651,7 +651,7 @@ module.exports = (function () { | |
* "max_proj" : 10, | ||
* "max_sav_qry" : 20, | ||
* "email" : "[email protected]" | ||
* | ||
* | ||
* | ||
* The client ID can be in the following formats: | ||
* - SDMS uname (e.g., "xxxxx...") | ||
|
@@ -1048,7 +1048,7 @@ module.exports = (function () { | |
* | ||
* @param {object} a_client - this is a user document i.e. | ||
* | ||
* | ||
* | ||
* "_key" : "bob", | ||
* "_id" : "u/bob", | ||
* "name" : "bob junior ", | ||
|