Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit 3281eb3

Browse files
committed
Clone of cs3org#3280 for cernbox
1 parent f58cafc commit 3281eb3

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

pkg/app/provider/wopi/wopi.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,24 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc
144144
q.Add("fileid", resource.GetId().OpaqueId)
145145
q.Add("endpoint", resource.GetId().StorageId)
146146
q.Add("viewmode", viewMode.String())
147+
q.Add("appname", p.conf.AppName)
147148

148149
u, ok := ctxpkg.ContextGetUser(ctx)
149-
if ok { // else defaults to "Guest xyz"
150+
if ok { // else username defaults to "Guest xyz"
150151
if u.Id.Type == userpb.UserType_USER_TYPE_LIGHTWEIGHT || u.Id.Type == userpb.UserType_USER_TYPE_FEDERATED {
151152
q.Add("userid", resource.Owner.OpaqueId+"@"+resource.Owner.Idp)
152153
} else {
153154
q.Add("userid", u.Id.OpaqueId+"@"+u.Id.Idp)
154155
}
155-
var isPublicShare bool
156+
157+
q.Add("username", url.QueryEscape(u.DisplayName))
156158
if u.Opaque != nil {
157159
if _, ok := u.Opaque.Map["public-share-role"]; ok {
158-
isPublicShare = true
160+
q.Del("username") // on public shares default to "Guest xyz"
159161
}
160162
}
161-
162-
if !isPublicShare {
163-
q.Add("username", u.Username)
164-
}
165163
}
166164

167-
q.Add("appname", p.conf.AppName)
168-
169165
var viewAppURL string
170166
if viewAppURLs, ok := p.appURLs["view"]; ok {
171167
if viewAppURL, ok = viewAppURLs[ext]; ok {

pkg/auth/manager/oidc/oidc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string)
247247
if err != nil {
248248
return nil, nil, err
249249
}
250+
// strip the `guest:` prefix if present in the email claim (appears to come from LDAP at CERN?)
251+
u.Mail = strings.Replace(u.Mail, "guest: ", "", 1)
252+
// and decorate the display name with the email domain to make it different from a primary account
253+
u.DisplayName = u.DisplayName + " (" + strings.Split(u.Mail, "@")[1] + ")"
250254
} else {
251255
scopes, err = scope.AddOwnerScope(nil)
252256
if err != nil {

0 commit comments

Comments
 (0)