-
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.
Merge branch 'devel' into 1209-feature-add-jsdoc-linter
- Loading branch information
Showing
22 changed files
with
1,441 additions
and
94 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
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# WARNING - Adding Tests | ||
|
||
Note The granularity of CMake is dependent on how they are defined in the CMakeLists.txt file. The tests are specified in | ||
CMake by passing a string that is matched against the chai test cases in the | ||
"it()" sections of the chai unit tests. Any test cases that match the pattern will run when that test is triggered. | ||
|
||
i.e. | ||
|
||
CMakeLists.txt line | ||
|
||
``` | ||
add_test(NAME foxx_record COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_record") | ||
``` | ||
|
||
This will pass "unit_record" as the pattern to be matched to the test_foxx.sh | ||
script. In turn, the test_foxx.sh script will call foxx test with | ||
"unit_record". Tests are not matched based on the name of the test file they | ||
are matched based on the test cases. | ||
|
||
i.e. | ||
|
||
Below is part of a test case that would be matched against the "unit_record" pattern. | ||
|
||
``` | ||
describe('Record Class', () => { | ||
it('unit_record: isPathConsistent should return false paths are inconsistent in new and old alloc.', () => { | ||
: | ||
: | ||
}); | ||
it('unit_record: isPathConsistent a different test case.', () => { | ||
: | ||
: | ||
}); | ||
}); | ||
``` | ||
|
||
Notice that 'unit_record' is explicitly mentioned in the test cases. In the above exerpt, both tests will run. If ctest were to be explicitly called we could run all unit_record tests with the following. | ||
|
||
``` | ||
ctest -R foxx_record | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"use strict"; | ||
|
||
const g_db = require("@arangodb").db; | ||
const path = require("path"); | ||
const g_lib = require("./support"); | ||
|
||
module.exports = (function () { | ||
let obj = {}; | ||
|
||
/** | ||
Check failure on line 10 in core/database/foxx/api/authz.js GitHub Actions / lint-javascript
Check failure on line 10 in core/database/foxx/api/authz.js GitHub Actions / lint-javascript
|
||
* @brief Will check to see if a client has the required permissions on a | ||
* record. | ||
* | ||
* @param {string} a_data_key - A datafed key associated with a record. Is not prepended with 'd/' | ||
Check failure on line 14 in core/database/foxx/api/authz.js GitHub Actions / lint-javascript
|
||
* @param {obj} a_client - A user document, the user associated with the document is the one | ||
* who we are verifying if they have permissions to on the data record. | ||
* | ||
* e.g. | ||
* | ||
* a_client id | ||
* | ||
* Client will contain the following information | ||
* { | ||
* "_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" : "bobjones@gmail.com" | ||
* } | ||
* | ||
* @param - the permission type that is being checked i.e. | ||
Check failure on line 37 in core/database/foxx/api/authz.js GitHub Actions / lint-javascript
|
||
* | ||
* PERM_CREATE | ||
* PERM_WR_DATA | ||
* PERM_RD_DATA | ||
**/ | ||
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 | ||
// to check if the user has the write authorization | ||
if (g_lib.hasAdminPermObject(a_client, data_id)) { | ||
return true; | ||
} | ||
let data = g_db.d.document(data_id); | ||
// Grab the data item | ||
if (g_lib.hasPermissions(a_client, data, a_perm)) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
|
||
return obj; | ||
})(); |
Oops, something went wrong.