add user info to sharepoint details (#3509)

<!-- PR description-->

add info about owner to Sharepoint details.

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🐛 Bugfix

#### Issue(s)

https://github.com/alcionai/corso/issues/3356

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
neha_gupta 2023-05-26 14:05:50 +05:30 committed by GitHub
parent f27ddb6a8c
commit 92845ed139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View File

@ -297,15 +297,29 @@ func filterUserPermissions(ctx context.Context, perms []models.Permissionable) [
// and kiota drops any SetSize update.
// TODO: Update drive name during Issue #2071
func sharePointItemInfo(di models.DriveItemable, itemSize int64) *details.SharePointInfo {
var id, driveName, driveID, weburl string
var driveName, siteID, driveID, weburl, creatorEmail string
// TODO: we rely on this info for details/restore lookups,
// so if it's nil we have an issue, and will need an alternative
// way to source the data.
if di.GetCreatedBy() != nil && di.GetCreatedBy().GetUser() != nil {
// User is sometimes not available when created via some
// external applications (like backup/restore solutions)
additionalData := di.GetCreatedBy().GetUser().GetAdditionalData()
ed, ok := additionalData["email"]
if !ok {
ed = additionalData["displayName"]
}
if ed != nil {
creatorEmail = *ed.(*string)
}
}
gsi := di.GetSharepointIds()
if gsi != nil {
id = ptr.Val(gsi.GetSiteId())
siteID = ptr.Val(gsi.GetSiteId())
weburl = ptr.Val(gsi.GetSiteUrl())
if len(weburl) == 0 {
@ -326,8 +340,9 @@ func sharePointItemInfo(di models.DriveItemable, itemSize int64) *details.ShareP
DriveID: driveID,
DriveName: driveName,
Size: itemSize,
Owner: id,
Owner: creatorEmail,
WebURL: weburl,
SiteID: siteID,
}
}

View File

@ -889,6 +889,7 @@ type SharePointInfo struct {
ParentPath string `json:"parentPath,omitempty"`
Size int64 `json:"size,omitempty"`
WebURL string `json:"webUrl,omitempty"`
SiteID string `json:"siteID,omitempty"`
}
// Headers returns the human-readable names of properties in a SharePointInfo