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:
parent
f27ddb6a8c
commit
92845ed139
@ -297,15 +297,29 @@ func filterUserPermissions(ctx context.Context, perms []models.Permissionable) [
|
|||||||
// and kiota drops any SetSize update.
|
// and kiota drops any SetSize update.
|
||||||
// TODO: Update drive name during Issue #2071
|
// TODO: Update drive name during Issue #2071
|
||||||
func sharePointItemInfo(di models.DriveItemable, itemSize int64) *details.SharePointInfo {
|
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,
|
// TODO: we rely on this info for details/restore lookups,
|
||||||
// so if it's nil we have an issue, and will need an alternative
|
// so if it's nil we have an issue, and will need an alternative
|
||||||
// way to source the data.
|
// 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()
|
gsi := di.GetSharepointIds()
|
||||||
if gsi != nil {
|
if gsi != nil {
|
||||||
id = ptr.Val(gsi.GetSiteId())
|
siteID = ptr.Val(gsi.GetSiteId())
|
||||||
weburl = ptr.Val(gsi.GetSiteUrl())
|
weburl = ptr.Val(gsi.GetSiteUrl())
|
||||||
|
|
||||||
if len(weburl) == 0 {
|
if len(weburl) == 0 {
|
||||||
@ -326,8 +340,9 @@ func sharePointItemInfo(di models.DriveItemable, itemSize int64) *details.ShareP
|
|||||||
DriveID: driveID,
|
DriveID: driveID,
|
||||||
DriveName: driveName,
|
DriveName: driveName,
|
||||||
Size: itemSize,
|
Size: itemSize,
|
||||||
Owner: id,
|
Owner: creatorEmail,
|
||||||
WebURL: weburl,
|
WebURL: weburl,
|
||||||
|
SiteID: siteID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -889,6 +889,7 @@ type SharePointInfo struct {
|
|||||||
ParentPath string `json:"parentPath,omitempty"`
|
ParentPath string `json:"parentPath,omitempty"`
|
||||||
Size int64 `json:"size,omitempty"`
|
Size int64 `json:"size,omitempty"`
|
||||||
WebURL string `json:"webUrl,omitempty"`
|
WebURL string `json:"webUrl,omitempty"`
|
||||||
|
SiteID string `json:"siteID,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Headers returns the human-readable names of properties in a SharePointInfo
|
// Headers returns the human-readable names of properties in a SharePointInfo
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user