NSFS | NC | IAM Service - Users CRUD API Implementation #8055
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explain the changes
AccountSpaceFS
(CRUD) - all the functions here will only work on an IAM user without access keys (no encryption is involved at this point).nsfs_account_schema
(all of them are not required):owner
= owner is the account ID that owns this account (permission-wise).creator
= creator is the account ID that created this account (internal information).path
= AWS path (identifier).generate_id
inmanage_nsfs_cli_utils.js
to avoid importing MongoDB code in new files, and reuse this function only.IamError
from the doc of users' action API.iam_utils
.iam_utils
.accountspace_fs
.account_schema_validation
for the case of an account without access keys (empty array), and for added properties in the schema.path
toiam_path
AWS_DEFAULT_PATH
toIAM_DEFAULT_PATH
path_prefix
toiam_path_prefix
ResponseMetadata
protection inreply
.docs/design/iam.md
)Get Started
section that would be the demo for IAM user management (docs/dev_guide/nc_nsfs_iam_developer_doc.md
)Issues:
Gaps:
username
is global scope - all config files names, it should be only under the root account in the future./etc/noobaa.conf.d/accounts/
, no hierarchy in FS (under discussion if it would be changed in the future).list_users
implementation.NoobaaEvent
at this point._translate_error_codes
was copied fromNameSpaceFS
andBucketSpaceFS
, but might need to be refactored to match the needs.password_last_used
we send a dummy value.master_key_id
from the root account, we should take the most updatedmaster_key_id
.update_user
(we will add this in the PR of IAM access keys).Testing Instructions:
Unit Tests
Please run:
sudo npx jest test_accountspace_fs.test.js
npx jest test_iam_utils.test.js
npx jest test_nc_nsfs_account_schema_validation.test.js
Manual Test
Currently, we do not validate the input, so the test should use only valid input.
sudo node src/cmd/manage_nsfs account add --name shira-1002 --new_buckets_path /tmp/nsfs_root1 --access_key <access-key> --secret_key <secret-key> --uid <uid> --gid <gid>
Note: before creating the account need to give permission to the
new_buckets_path
:chmod 777 /tmp/nsfs_root1
.sudo node src/cmd/nsfs --debug 5 --https_port_iam 7005
Note: before starting the server please add this line:
process.env.NOOBAA_LOG_LEVEL = 'nsfs';
in the endpoint.js (before the conditionif (process.env.NOOBAA_LOG_LEVEL) {
)alias s3-nc-user-1-iam='AWS_ACCESS_KEY_ID=<acess-key> AWS_SECRET_ACCESS_KEY=<secret-key> aws --no-verify-ssl --endpoint-url https://localhost:7005'
.s3-nc-user-1-iam iam create-user --user-name Bob --path '/division_abc/subdivision_xyz/'
s3-nc-user-1-iam iam get-user --user-name Bob
s3-nc-user-1-iam iam update-user --user-name Bob --new-user-name Robert --new-path '/division_abc/subdivision_abc/'
s3-nc-user-1-iam iam delete-user --user-name Bob
s3-nc-user-1-iam iam list-users