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

feat: Add more flags for folder update collaborators #438

Merged
merged 8 commits into from
Dec 9, 2022
14 changes: 14 additions & 0 deletions src/commands/folders/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ class FoldersUpdateCommand extends BoxCommand {
if (flags.name) {
updates.name = flags.name;
}
if (flags.hasOwnProperty('can-non-owners-invite') ) {
updates.can_non_owners_invite = flags['can-non-owners-invite'];
}
if (flags.hasOwnProperty('can-non-owners-view-collaborators')) {
updates.can_non_owners_view_collaborators = flags['can-non-owners-view-collaborators'];
}
if (flags.hasOwnProperty('description')) {
updates.description = flags.description;
}
Expand Down Expand Up @@ -48,6 +54,14 @@ FoldersUpdateCommand._endpoint = 'put_folders_id';
FoldersUpdateCommand.flags = {
...BoxCommand.flags,
name: flags.string({ description: 'New name for folder' }),
'can-non-owners-invite': flags.boolean({
description: 'Specifies if users who are not the owner of the folder can invite new collaborators to the folder.',
allowNo: true
}),
'can-non-owners-view-collaborators': flags.boolean({
description: 'Restricts collaborators who are not the owner of this folder from viewing other collaborations on this folder.',
allowNo: true,
}),
description: flags.string({ description: 'New description for folder' }),
'upload-email-access': flags.string({
description: 'Upload email access level',
Expand Down
16 changes: 16 additions & 0 deletions test/commands/folders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,22 @@ describe('Folders', () => {
'--no-restrict-to-enterprise',
{is_collaboration_restricted_to_enterprise: false}
],
'can non owners invite flag': [
'--can-non-owners-invite',
{can_non_owners_invite: true}
],
'no can non owners invite flag': [
'--no-can-non-owners-invite',
{can_non_owners_invite: false}
],
'can non owners view collaborations flag': [
'--can-non-owners-view-collaborators',
{can_non_owners_view_collaborators: true}
],
'no can non owners view collaborations flag': [
'--no-can-non-owners-view-collaborators',
{can_non_owners_view_collaborators: false}
],
'upload email access flag': [
'--upload-email-access=open',
{folder_upload_email: {access: 'open'}}
Expand Down