Skip to content

Commit

Permalink
Apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaSBrown committed Jan 9, 2025
1 parent c97251a commit 6ca1ee2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
44 changes: 22 additions & 22 deletions core/database/foxx/api/authz.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions core/database/foxx/api/posix_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ const path = require("path");
module.exports = (function () {
let obj = {};

/**
* Splits a POSIX path string into its components.
*
* @param {string} a_posix_path - The POSIX path to be split.
*
* @returns {string[]} An array of path components.
*
* @throws {Error} If the provided path is not a valid string.
*
* @example
* // Input:
* const posixPath = '/usr/local/bin/node';
*
* // Output:
* ['usr', 'local', 'bin', 'node']
*/
/**
* Splits a POSIX path string into its components.
*
* @param {string} a_posix_path - The POSIX path to be split.
*
* @returns {string[]} An array of path components.
*
* @throws {Error} If the provided path is not a valid string.
*
* @example
* // Input:
* const posixPath = '/usr/local/bin/node';
*
* // Output:
* ['usr', 'local', 'bin', 'node']
*/
obj.splitPOSIXPath = function (a_posix_path) {
if (!a_posix_path || typeof a_posix_path !== "string") {
throw new Error("Invalid POSIX path");
Expand Down
8 changes: 4 additions & 4 deletions core/database/foxx/api/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { errors } = require("@arangodb");

/**
* Represents a record in the database and provides methods to manage it.
*
*
* @class
*/
class Record {
Expand All @@ -27,7 +27,7 @@ class Record {

/**
* Constructs a Record object and checks if the key exists in the database.
*
*
* @class
* @param {string} a_key - The unique identifier for the record. Must be a valid key in the database.
*/
Expand Down Expand Up @@ -62,7 +62,7 @@ class Record {

/**
* Generates the full path to the record as it should appear in the repository.
*
*
* @param {string} basePath - The base path where the record is stored.
* @returns {string} - The full path to the record.
*/
Expand All @@ -72,7 +72,7 @@ class Record {

/**
* Compares two paths and if an error is detected will save the error code and message.
*
*
* @param {string} storedPath - the path stored in the database
* @param {string} inputPath - the path being checked
* @returns {boolean} - true if paths are equal false otherwise
Expand Down
6 changes: 3 additions & 3 deletions core/database/foxx/api/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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...")
Expand Down Expand Up @@ -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 ",
Expand Down

0 comments on commit 6ca1ee2

Please sign in to comment.