Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1199 feature add support for scoped lookup #1225

Open
wants to merge 35 commits into
base: 1180-refactor-authz
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ed4398b
Add tests for foxx project class
JoshuaSBrown Jan 2, 2025
5b5ee4e
Create initial strategy methods for authz
JoshuaSBrown Jan 2, 2025
16d0d15
Implement strategy method calls in authz_router
JoshuaSBrown Jan 2, 2025
86239e4
Add methods to repo class, for checking allocations, admins, and proj…
JoshuaSBrown Jan 2, 2025
2c616d2
Add repo unit tests.
JoshuaSBrown Jan 2, 2025
c58ebab
Add abstractions for project and user, as well as unit tests for proj…
JoshuaSBrown Jan 2, 2025
64bc44f
Move controllers into controller folder
JoshuaSBrown Jan 2, 2025
552cf93
Pass in repo object to strategy methods
JoshuaSBrown Jan 2, 2025
d131a14
Pull in latest changes
JoshuaSBrown Jan 2, 2025
1396f7f
Apply formatting to javasript in foxx
JoshuaSBrown Jan 2, 2025
0ae304a
Address conflicts from formatting
JoshuaSBrown Jan 6, 2025
4f62a05
Address JSDoc differences
JoshuaSBrown Jan 13, 2025
ca85a70
Address merge conflicts
JoshuaSBrown Jan 13, 2025
85d1b1f
Address merge conflicts
JoshuaSBrown Jan 13, 2025
8437b65
Address merge conflict
JoshuaSBrown Jan 13, 2025
001f32d
Adjust controllers update from 1180
JoshuaSBrown Jan 14, 2025
64a2fc2
Address differentces in authz.js
JoshuaSBrown Jan 14, 2025
233d2a5
Further corrections to branch
JoshuaSBrown Jan 14, 2025
88c3d6c
Address merge conflict
JoshuaSBrown Jan 14, 2025
bc34ad3
Address leftover diff header
JoshuaSBrown Jan 14, 2025
584b196
Return true if access allowed
JoshuaSBrown Jan 14, 2025
43ccca1
Remove debug commands
JoshuaSBrown Jan 14, 2025
49c91f5
Merge in latest changes
JoshuaSBrown Jan 15, 2025
6c586fb
Address merge conflict
JoshuaSBrown Jan 16, 2025
86b5349
Remove superflous comments
JoshuaSBrown Jan 17, 2025
5a291c4
Apply formatting
JoshuaSBrown Jan 17, 2025
f51b41f
Address eslint complaints about JSDoc
JoshuaSBrown Jan 17, 2025
cdb0dca
Test that NOT_FOUND error is thrown
JoshuaSBrown Jan 17, 2025
fb99dc2
Address feedback
JoshuaSBrown Jan 17, 2025
e7972b8
Merge pull request #1224 from ORNL/1180-refactor-authz
JoshuaSBrown Jan 17, 2025
8249a5b
Merge branch 'devel' into 1199-feature-add-support-for-scoped-lookup
JoshuaSBrown Jan 17, 2025
933e39d
Add in missing permission to lookupRecord authz call
JoshuaSBrown Jan 17, 2025
a18ab2c
Turn off automatic approval for lookup and chdir in repo
JoshuaSBrown Jan 17, 2025
fe578ed
Add missing gcs build trigger
JoshuaSBrown Jan 17, 2025
fa1ee90
Remove commented out code for lookup and chdir
JoshuaSBrown Jan 17, 2025
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
2 changes: 2 additions & 0 deletions core/database/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if( ENABLE_FOXX_TESTS )
add_test(NAME foxx_record COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_record")
add_test(NAME foxx_repo COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_repo")
add_test(NAME foxx_path COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_path")
add_test(NAME foxx_project COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_project")
add_test(NAME foxx_db_fixtures COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_fixture_setup.sh")
add_test(NAME foxx_version COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_version")
add_test(NAME foxx_support COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_support")
Expand All @@ -33,5 +34,6 @@ if( ENABLE_FOXX_TESTS )
set_tests_properties(foxx_record PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_repo PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_path PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_project PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_user_router PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures")
endif()
191 changes: 0 additions & 191 deletions core/database/foxx/api/authz.js

This file was deleted.

48 changes: 33 additions & 15 deletions core/database/foxx/api/authz_router.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const router = createRouter();
const joi = require("joi");
const g_db = require("@arangodb").db;
const g_lib = require("./support");
const authzModule = require("./authz");
const { Repo, PathType } = require("./repo");
const authzModule = require("./controllers/authz");
const { Repo, PathType } = require("./controllers/repo");

module.exports = router;

Expand Down Expand Up @@ -74,22 +74,40 @@ router
// Determine permissions associated with path provided
// Actions: read, write, create, delete, chdir, lookup
if (Object.keys(authzModule.authz_strategy).includes(req.queryParams.act)) {
authzModule.authz_strategy[req.queryParams.act][path_type](
client,
req.queryParams.file,
);
if (
authzModule.authz_strategy[req.queryParams.act][path_type](
client,
req.queryParams.file,
repo,
)
) {
console.log(
"AUTHZ act: " +
req.queryParams.act +
" client: " +
client._id +
" path " +
req.queryParams.file +
" SUCCESS",
);
} else {
console.log(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be console.error?

Suggested change
console.log(
console.error(

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good correction!

"AUTHZ act: " +
req.queryParams.act +
" client: " +
client._id +
" path " +
req.queryParams.file +
" DENIED",
);
throw [
g_lib.ERR_PERM_DENIED,
"Client (" + client._id + ") denied access to: " + req.queryParams.file,
];
}
} else {
throw [g_lib.ERR_INVALID_PARAM, "Invalid gridFTP action: ", req.queryParams.act];
}
console.log(
"AUTHZ act: " +
req.queryParams.act +
" client: " +
client._id +
" path " +
req.queryParams.file +
" SUCCESS",
);
} catch (e) {
g_lib.handleException(e, res);
}
Expand Down
Loading
Loading