Skip to content

Commit

Permalink
add default value for path
Browse files Browse the repository at this point in the history
Signed-off-by: shirady <[email protected]>
  • Loading branch information
shirady committed May 16, 2024
1 parent adf19b7 commit a1891df
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/endpoint/iam/ops/iam_create_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function create_user(req, res) {
CreateUserResponse: {
CreateUserResult: {
User: {
Path: reply.path ? reply.path : iam_utils.AWS_EMPTY_PATH,
Path: reply.path ?? iam_utils.AWS_EMPTY_PATH,
UserName: reply.username,
UserId: reply.user_id,
Arn: reply.arn,
Expand Down
2 changes: 1 addition & 1 deletion src/endpoint/iam/ops/iam_get_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function get_user(req, res) {
GetUserResult: {
User: {
UserId: reply.user_id,
Path: reply.path,
Path: reply.path ?? iam_utils.AWS_EMPTY_PATH,
UserName: reply.username,
Arn: reply.arn,
CreateDate: iam_utils.format_iam_xml_date(reply.create_date),
Expand Down
2 changes: 1 addition & 1 deletion src/endpoint/iam/ops/iam_list_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function list_users(req, res) {
Users: reply.members.map(member => ({
member: {
UserId: member.user_id,
Path: member.path,
Path: member.path ?? iam_utils.AWS_EMPTY_PATH,
UserName: member.username,
Arn: member.arn,
CreateDate: iam_utils.format_iam_xml_date(member.create_date),
Expand Down
3 changes: 2 additions & 1 deletion src/endpoint/iam/ops/iam_update_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

const dbg = require('../../../util/debug_module')(__filename);
const iam_utils = require('../iam_utils');
const { FORM_URL_ENCODED } = require('../../../util/http_utils');

/**
Expand All @@ -22,7 +23,7 @@ async function update_user(req, res) {
UpdateUserResponse: {
UpdateUserResult: {
User: {
Path: reply.path,
Path: reply.path ?? iam_utils.AWS_EMPTY_PATH,
UserName: reply.username,
UserId: reply.user_id,
Arn: reply.arn,
Expand Down
10 changes: 5 additions & 5 deletions src/sdk/accountspace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class AccountSpaceFS {
async create_user(params, account_sdk) {
dbg.log1('create_user', params);
return {
path: params.path,
path: params.path ?? AWS_EMPTY_PATH,
username: params.username,
user_id: dummy_user1.user_id,
arn: create_arn(dummy_account_id, params.username, params.path),
Expand All @@ -110,7 +110,7 @@ class AccountSpaceFS {
const { dummy_user } = get_user_details(params.username);
return {
user_id: dummy_user.user_id,
path: dummy_user.path,
path: dummy_user.path ?? AWS_EMPTY_PATH,
username: dummy_user.username,
arn: create_arn(dummy_account_id, dummy_user.username, dummy_user.path),
create_date: new Date(Date.now() - 30 * MS_PER_MINUTE),
Expand All @@ -123,7 +123,7 @@ class AccountSpaceFS {
const path_friendly = params.new_path ? params.new_path : dummy_user1.path;
const username = params.new_username ? params.new_username : params.username;
return {
path: path_friendly,
path: path_friendly ?? AWS_EMPTY_PATH,
username: username,
user_id: dummy_user1.user_id,
arn: create_arn(dummy_account_id, username, path_friendly),
Expand All @@ -142,15 +142,15 @@ class AccountSpaceFS {
const members = [
{
user_id: dummy_user1.user_id,
path: dummy_user1.path,
path: dummy_user1.path ?? AWS_EMPTY_PATH,
username: dummy_user1.username,
arn: create_arn(dummy_account_id, dummy_user1.username, dummy_user1.path),
create_date: new Date(Date.now() - 30 * MS_PER_MINUTE),
password_last_used: new Date(Date.now() - MS_PER_MINUTE),
},
{
user_id: dummy_user2.user_id,
path: dummy_user2.path,
path: dummy_user2.path ?? AWS_EMPTY_PATH,
username: dummy_user2.username,
arn: create_arn(dummy_account_id, dummy_user2.username, dummy_user1.path),
create_date: new Date(Date.now() - 30 * MS_PER_MINUTE),
Expand Down

0 comments on commit a1891df

Please sign in to comment.