-
Notifications
You must be signed in to change notification settings - Fork 236
feat: move adding agent owner to collaborator #14384
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
Open
tecton
wants to merge
7
commits into
dev
Choose a base branch
from
nintan/collaboration-add-owner
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,483
−532
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8323c6c
feat: move adding agent owner to collaborator
tecton ddba682
fix: unit tests
tecton 6da8dfa
Merge branch 'dev' into nintan/collaboration-add-owner
tecton af58299
fix: ut coverage
tecton e290edf
feat(cli): move agent owner management to collaboration
tecton 936d09c
fix: unit test
tecton cbda936
fix: ut coverage
tecton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { CLICommand, InputsWithProjectPath, err, ok } from "@microsoft/teamsfx-api"; | ||
import { PermissionGrantInputs, PermissionGrantOptions } from "@microsoft/teamsfx-core"; | ||
import { | ||
CLICommand, | ||
CLICommandOption, | ||
err, | ||
InputsWithProjectPath, | ||
ok, | ||
} from "@microsoft/teamsfx-api"; | ||
import { | ||
CollaborationConstants, | ||
featureFlagManager, | ||
FeatureFlags, | ||
PermissionGrantInputs, | ||
PermissionGrantOptions, | ||
QuestionNames, | ||
} from "@microsoft/teamsfx-core"; | ||
import { getFxCore } from "../../activate"; | ||
import { logger } from "../../commonlib/logger"; | ||
import { MissingRequiredOptionError } from "../../error"; | ||
|
@@ -20,10 +33,21 @@ export const spfxMessage = | |
"Manage site admins using SharePoint admin center: " + | ||
"https://docs.microsoft.com/en-us/sharepoint/manage-site-collection-administrators"; | ||
|
||
export const agentOwnerOption: CLICommandOption = { | ||
name: "agent", | ||
type: "boolean", | ||
default: false, | ||
description: "Whether share the ownership of agent.", | ||
}; | ||
|
||
export const permissionGrantCommand: CLICommand = { | ||
name: "grant", | ||
description: commands["collaborator.grant"].description, | ||
options: [...PermissionGrantOptions, ProjectFolderOption], | ||
options: [ | ||
...PermissionGrantOptions, | ||
ProjectFolderOption, | ||
...(featureFlagManager.getBooleanValue(FeatureFlags.ShareEnabled) ? [agentOwnerOption] : []), | ||
], | ||
telemetry: { | ||
event: TelemetryEvent.GrantPermission, | ||
}, | ||
|
@@ -32,18 +56,34 @@ export const permissionGrantCommand: CLICommand = { | |
command: `${process.env.TEAMSFX_CLI_BIN_NAME} collaborator grant -i false --manifest-file ./appPackage/manifest.json --env dev --email [email protected]`, | ||
description: "Grant permission for another Microsoft 365 account to collaborate on the app.", | ||
}, | ||
...(featureFlagManager.getBooleanValue(FeatureFlags.ShareEnabled) | ||
? [ | ||
{ | ||
command: `${process.env.TEAMSFX_CLI_BIN_NAME} collaborator grant -i false --agent true --env dev --email [email protected]`, | ||
description: | ||
"Grant permission for another Microsoft 365 account as owner of the agent.", | ||
}, | ||
] | ||
: []), | ||
], | ||
handler: async (ctx) => { | ||
const inputs = ctx.optionValues as PermissionGrantInputs & InputsWithProjectPath; | ||
// print necessary messages | ||
logger.info(azureMessage); | ||
logger.info(spfxMessage); | ||
if (ctx.optionValues["agent"]) { | ||
inputs[QuestionNames.collaborationAppType] = [CollaborationConstants.AgentOptionId]; | ||
} | ||
if (!ctx.globalOptionValues.interactive) { | ||
if (!inputs["manifest-file-path"] && !inputs["manifest-path"]) { | ||
if ( | ||
!ctx.optionValues["agent"] && | ||
!inputs["entra-app-manifest-file"] && | ||
!inputs["manifest-path"] | ||
) { | ||
return err( | ||
new MissingRequiredOptionError( | ||
ctx.command.fullName, | ||
"--manifest-file-path or --manifest-path" | ||
"--entra-app-manifest-file or --manifest-path" | ||
) | ||
); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,10 +44,6 @@ export const shareCommand: CLICommand = { | |
command: `${process.env.TEAMSFX_CLI_BIN_NAME} share --scope users --email '[email protected],[email protected]' -i false`, | ||
description: "Share the agent with specific users", | ||
}, | ||
{ | ||
command: `${process.env.TEAMSFX_CLI_BIN_NAME} share --scope owners --email '[email protected],[email protected]' -i false`, | ||
description: "Share the ownership of agent with selected users", | ||
}, | ||
], | ||
commands: [shareRemoveCommand], | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.