use proper resource ids in factory (#3912)
#### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🐛 Bugfix #### Test Plan - [x] 💚 E2E
This commit is contained in:
parent
3613cb2aa0
commit
0c25c568c1
3
.github/actions/slack-message/action.yml
vendored
3
.github/actions/slack-message/action.yml
vendored
@ -31,6 +31,7 @@ runs:
|
||||
- name: use url or blank val
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STEP=${{ github.action || '' }}" >> $GITHUB_ENV
|
||||
echo "JOB=${{ github.job || '' }}" >> $GITHUB_ENV
|
||||
echo "LOGS=${{ github.run_id && env.logurl || '-' }}" >> $GITHUB_ENV
|
||||
echo "COMMIT=${{ github.sha && env.commiturl || '-' }}" >> $GITHUB_ENV
|
||||
@ -50,7 +51,7 @@ runs:
|
||||
"type": "section",
|
||||
"text": {
|
||||
"type": "mrkdwn",
|
||||
"text": "${{ inputs.msg }} :: ${{ env.JOB }}\n${{ env.LOGS }} ${{ env.COMMIT }} ${{ env.REF }}"
|
||||
"text": "${{ inputs.msg }} :: ${{ env.JOB }} - ${{ env.STEP }}\n${{ env.LOGS }} ${{ env.COMMIT }} ${{ env.REF }}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@ -224,7 +224,8 @@ var (
|
||||
|
||||
func generateAndRestoreDriveItems(
|
||||
ctrl *m365.Controller,
|
||||
resourceOwner, secondaryUserID, secondaryUserName string,
|
||||
protectedResource idname.Provider,
|
||||
secondaryUserID, secondaryUserName string,
|
||||
acct account.Account,
|
||||
service path.ServiceType,
|
||||
cat path.CategoryType,
|
||||
@ -248,14 +249,23 @@ func generateAndRestoreDriveItems(
|
||||
|
||||
switch service {
|
||||
case path.SharePointService:
|
||||
d, err := ctrl.AC.Stable.Client().Sites().BySiteId(resourceOwner).Drive().Get(ctx, nil)
|
||||
d, err := ctrl.AC.Stable.
|
||||
Client().
|
||||
Sites().
|
||||
BySiteId(protectedResource.ID()).
|
||||
Drive().
|
||||
Get(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, clues.Wrap(err, "getting site's default drive")
|
||||
}
|
||||
|
||||
driveID = ptr.Val(d.GetId())
|
||||
default:
|
||||
d, err := ctrl.AC.Stable.Client().Users().ByUserId(resourceOwner).Drive().Get(ctx, nil)
|
||||
d, err := ctrl.AC.Stable.Client().
|
||||
Users().
|
||||
ByUserId(protectedResource.ID()).
|
||||
Drive().
|
||||
Get(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, clues.Wrap(err, "getting user's default drive")
|
||||
}
|
||||
@ -423,7 +433,7 @@ func generateAndRestoreDriveItems(
|
||||
Resource: resource.Users,
|
||||
Service: service,
|
||||
Tenant: tenantID,
|
||||
ResourceOwners: []string{resourceOwner},
|
||||
ResourceOwners: []string{protectedResource.ID()},
|
||||
RestoreCfg: restoreCfg,
|
||||
}
|
||||
|
||||
@ -438,7 +448,7 @@ func generateAndRestoreDriveItems(
|
||||
rcc := inject.RestoreConsumerConfig{
|
||||
BackupVersion: version.Backup,
|
||||
Options: opts,
|
||||
ProtectedResource: sel,
|
||||
ProtectedResource: protectedResource,
|
||||
RestoreConfig: restoreCfg,
|
||||
Selector: sel,
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ func handleOneDriveFileFactory(cmd *cobra.Command, args []string) error {
|
||||
|
||||
deets, err := generateAndRestoreDriveItems(
|
||||
ctrl,
|
||||
inp.ID(),
|
||||
inp,
|
||||
SecondaryUser,
|
||||
strings.ToLower(SecondaryUser),
|
||||
acct,
|
||||
|
||||
@ -47,7 +47,7 @@ func handleSharePointLibraryFileFactory(cmd *cobra.Command, args []string) error
|
||||
|
||||
deets, err := generateAndRestoreDriveItems(
|
||||
ctrl,
|
||||
inp.ID(),
|
||||
inp,
|
||||
SecondaryUser,
|
||||
strings.ToLower(SecondaryUser),
|
||||
acct,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user