Skip to content

Convert options used in validation to option sets #3854

Description

@Jwaegebaert

On a few locations we have validation logic that checks if a option is in use from a set of options. For example within spo folder roleassignment remove.

const principalOptions: any[] = [args.options.principalId, args.options.upn, args.options.groupName];
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) {
return `Specify either principalId id, upn or groupName`;
}
if (principalOptions.filter(item => item !== undefined).length === 0) {
return `Specify at least principalId id, upn or groupName`;
}

This can be achieved by adding the values wihtin principalOptions to this.optionSets.

#initOptionSets(): void {
  this.optionSets.push(
    ['principalId', 'upn', 'groupName']
  );
}

Following command could use this convertion

Command Options
aad app add [manifest, name]
adaptivecard send [card, title]
planner bucket get [id, name]
planner plan get [id, title]
spo file roleassignment add [principalId, upn, groupName], [roleDefinitionId, roleDefinitionName]
spo file roleassignment remove [principalId, upn, groupName]
spo list roleassignment add [listId, listTitle, listUrl], [principalId, upn, groupName], [roleDefinitionId, roleDefinitionName]
spo list roleassignment remove [listId, listTitle, listUrl], [principalId, upn, groupName]
spo listitem list [id, title, listId, listTitle]
spo listitem roleassignment remove [listId, listTitle, listUrl], [principalId, upn, groupName]
spo page clientsidewebpart [standardWebPart, webPartId]
spo sitedesign get [id, title]
spo sitedesign get [id, title]
spo web roleassignment add [principalId, upn, groupName], [roleDefinitionId, roleDefinitionName]
spo web roleassignment remove [principalId, upn, groupName]
teams team archive [id, name, teamId]
teams team remove [id, name, teamId]
teams team unarchive [id, name, teamId]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions