-
Notifications
You must be signed in to change notification settings - Fork 77
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
Nc account by id #8167
base: master
Are you sure you want to change the base?
Nc account by id #8167
Conversation
2a5df3c
to
d860c93
Compare
@@ -8,7 +8,6 @@ module.exports = { | |||
'_id', | |||
'name', | |||
'system_owner', | |||
'bucket_owner', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you can rename the owner_account
.
The property name is owner_account
because we had duplicated information (both bucket_owner
and owner_account
describe the owner of the bucket) and wanted a different name.
@romayalon @guymguym @naveenpaul1 If you think otherwise, please share.
@@ -450,8 +432,7 @@ describe('schema validation NC NSFS bucket', () => { | |||
function get_bucket_data() { | |||
const bucket_name = 'bucket1'; | |||
const id = '65a62e22ceae5e5f1a758aa8'; | |||
const system_owner = 'account1'; // GAP - currently account name | |||
const bucket_owner = 'account1'; // account name | |||
const system_owner = '65b3c68b59ab67b16f98c26e'; // GAP - currently account name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const system_owner = '65b3c68b59ab67b16f98c26e'; // GAP - currently account name | |
const system_owner = '65b3c68b59ab67b16f98c26e'; // GAP - currently bucket owner id |
@@ -58,18 +58,18 @@ async function get_config_data(config_root_backend, config_file_path, show_secre | |||
* get_bucket_owner_account will return the account of the bucket_owner | |||
* otherwise it would throw an error | |||
* @param {string} config_root_backend | |||
* @param {string} accounts_dir_path | |||
* @param {string} bucket_owner | |||
* @param {string} dir_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What can be dir_path
? would you please add details in the comment?
* @param {string} accounts_dir_path | ||
* @param {string} bucket_owner | ||
* @param {string} dir_path | ||
* @param {string} name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure changing the argument to just name
is clearer (reading the function statement one might think it is a bucket name).
@@ -247,7 +247,7 @@ function validate_flags_value_combination(type, action, input_options_with_data) | |||
* @param {object} data | |||
* @param {string} action | |||
*/ | |||
async function validate_bucket_args(config_root_backend, accounts_dir_path, data, action) { | |||
async function validate_bucket_args(config_root_backend, accounts_dir_path, root_accounts_dir_path, data, action) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alphaprinz @romayalon @naveenpaul1 @guymguym
Any ideas on how can pass the information of those arguments to the module that is not by every function?
config_root_backend
, accounts_dir_path
, root_accounts_dir_path
*/ | ||
async function verify_delete_account(config_root_backend, buckets_dir_path, account_name) { | ||
async function verify_delete_account(config_root_backend, buckets_dir_path, account_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this function with the current implementation that looks at ALL the buckets?
Can we add in the structure of the config to reflect the relationship: root account -> the buckets that it owns (like we would have root account -> the IAM accounts that it owns).
return true; | ||
} catch (err) { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name is _get_account_by_name
but it returns a boolean (true/false), I'm not sure I understand.
const account_config_path = this._get_account_config_path(bucket.owner_account); | ||
data = (await nb_native().fs.readFile(this.fs_context, account_config_path)).data; | ||
const account = JSON.parse(data.toString()); | ||
nsfs_schema_utils.validate_account_schema(account); | ||
is_valid = await this.check_bucket_config(bucket); | ||
if (!is_valid) { | ||
dbg.warn('BucketSpaceFS: account linked to bucket is not valid: ', name); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this addition?
Please also add in comments.
@@ -312,8 +336,7 @@ class BucketSpaceFS extends BucketSpaceSimpleFS { | |||
name, | |||
tag: js_utils.default_value(tag, undefined), | |||
owner_account: account._id, | |||
system_owner: new SensitiveString(account.name), | |||
bucket_owner: new SensitiveString(account.name), | |||
system_owner: account._id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You removed the new SensitiveString
it might create an issue with the containerized enviroment, make sure that you handle the places where is it unwrapped (or leave it with SensitiveString...).
//write_stdout_response(ManageCLIResponse.AccountUpdated, "update_name 2 = " + update_name); | ||
await nb_native().fs.unlink(fs_context, cur_root_account_config_path); | ||
await nb_native().fs.symlink(fs_context, new_account_relative_config_path, new_root_account_config_path); | ||
}// else if (update_access_key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the "else if (update_access_key)" in a comment?
d860c93
to
eabba80
Compare
…to it Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
… account id Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
c9672e8
to
12e9d94
Compare
Signed-off-by: Amit Prinz Setter <[email protected]>
12e9d94
to
f36fb47
Compare
…) and test_bucketspace_fs.js Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
2f227ae
to
da61744
Compare
098d3d4
to
6e80cbc
Compare
Signed-off-by: Amit Prinz Setter <[email protected]>
25a75ea
to
598b40a
Compare
Signed-off-by: Amit Prinz Setter <[email protected]>
c91bfce
to
94a21c2
Compare
Signed-off-by: Amit Prinz Setter <[email protected]>
94a21c2
to
665d0ff
Compare
Explain the changes
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: