Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

check user logic #22

Open
wkloucek opened this issue Dec 5, 2023 · 0 comments
Open

check user logic #22

wkloucek opened this issue Dec 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@wkloucek
Copy link
Owner

wkloucek commented Dec 5, 2023

// user logic from reva wopi driver #TODO: refactor
var isPublicShare bool = false
if wopiContext.User != nil {
if wopiContext.User.Id.Type == userv1beta1.UserType_USER_TYPE_LIGHTWEIGHT {
fileInfo.UserID = statRes.Info.Owner.OpaqueId + "@" + statRes.Info.Owner.Idp
} else {
fileInfo.UserID = wopiContext.User.Id.OpaqueId + "@" + wopiContext.User.Id.Idp
}
if wopiContext.User.Opaque != nil {
if _, ok := wopiContext.User.Opaque.Map["public-share-role"]; ok {
isPublicShare = true
}
}
if !isPublicShare {
fileInfo.UserFriendlyName = wopiContext.User.Username
fileInfo.UserID = wopiContext.User.Id.OpaqueId + "@" + wopiContext.User.Id.Idp
}
}
if wopiContext.User == nil || isPublicShare {
randomID, _ := uuid.NewUUID()
fileInfo.UserID = "guest-" + randomID.String()
fileInfo.UserFriendlyName = "Guest " + randomID.String()
fileInfo.IsAnonymousUser = true
}

@wkloucek wkloucek added the enhancement New feature or request label Dec 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant