Merge branch 'master' into MergeMasterIntoExperimental
This commit is contained in:
commit
41dcd770fb
19 files changed
+155
-66
No files matched your search
@@ -203,7 +203,6 @@ func createGroupModelFromCS3(g *cs3group.Group) *libregraph.Group {
|
||||
OnPremisesDomainName: &g.Id.Idp,
|
||||
OnPremisesSamAccountName: &g.GroupName,
|
||||
DisplayName: &g.DisplayName,
|
||||
Mail: &g.Mail,
|
||||
// TODO when to fetch and expand memberof, usernames or ids?
|
||||
}
|
||||
}
|
||||
@@ -223,7 +223,6 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
csr := storageprovider.CreateStorageSpaceRequest{
|
||||
Owner: us,
|
||||
Type: driveType,
|
||||
Name: spaceName,
|
||||
Quota: getQuota(drive.Quota, g.config.Spaces.DefaultQuota),
|
||||
@@ -237,6 +236,10 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
|
||||
csr.Opaque = utils.AppendPlainToOpaque(csr.Opaque, "spaceAlias", *drive.DriveAlias)
|
||||
}
|
||||
|
||||
if driveType == "personal" {
|
||||
csr.Owner = us
|
||||
}
|
||||
|
||||
resp, err := client.CreateStorageSpace(r.Context(), &csr)
|
||||
if err != nil {
|
||||
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())
|
||||
@@ -733,6 +736,17 @@ func listStorageSpacesIDFilter(id string) *storageprovider.ListStorageSpacesRequ
|
||||
}
|
||||
}
|
||||
|
||||
func listStorageSpacesUserFilter(id string) *storageprovider.ListStorageSpacesRequest_Filter {
|
||||
return &storageprovider.ListStorageSpacesRequest_Filter{
|
||||
Type: storageprovider.ListStorageSpacesRequest_Filter_TYPE_USER,
|
||||
Term: &storageprovider.ListStorageSpacesRequest_Filter_User{
|
||||
User: &userv1beta1.UserId{
|
||||
OpaqueId: id,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func listStorageSpacesTypeFilter(spaceType string) *storageprovider.ListStorageSpacesRequest_Filter {
|
||||
return &storageprovider.ListStorageSpacesRequest_Filter{
|
||||
Type: storageprovider.ListStorageSpacesRequest_Filter_TYPE_SPACE_TYPE,
|
||||
|
||||
@@ -11,9 +11,12 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/CiscoM31/godata"
|
||||
cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/events"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/render"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
@@ -21,6 +24,7 @@ import (
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode"
|
||||
settingssvc "github.com/owncloud/ocis/v2/services/settings/pkg/service/v0"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
// GetMe implements the Service interface.
|
||||
@@ -171,6 +175,43 @@ func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) {
|
||||
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
}
|
||||
sel := strings.Split(r.URL.Query().Get("$select"), ",")
|
||||
exp := strings.Split(r.URL.Query().Get("$expand"), ",")
|
||||
if slices.Contains(sel, "drive") || slices.Contains(sel, "drives") || slices.Contains(exp, "drive") || slices.Contains(exp, "drives") {
|
||||
wdu, err := url.Parse(g.config.Spaces.WebDavBase + g.config.Spaces.WebDavPath)
|
||||
f := listStorageSpacesUserFilter(user.GetId())
|
||||
lspr, err := g.gatewayClient.ListStorageSpaces(r.Context(), &storageprovider.ListStorageSpacesRequest{
|
||||
Opaque: nil,
|
||||
Filters: []*storageprovider.ListStorageSpacesRequest_Filter{f},
|
||||
})
|
||||
if err != nil {
|
||||
g.logger.Err(err).Interface("query", r.URL.Query()).Msg("error getting storages")
|
||||
render.Status(r, http.StatusInternalServerError)
|
||||
render.JSON(w, r, user)
|
||||
return
|
||||
}
|
||||
if lspr.Status.Code != cs3rpc.Code_CODE_OK {
|
||||
// in case of NOT_OK, we can just return the user object with empty drives
|
||||
render.Status(r, status.HTTPStatusFromCode(http.StatusOK))
|
||||
render.JSON(w, r, user)
|
||||
return
|
||||
}
|
||||
drives := []libregraph.Drive{}
|
||||
for _, sp := range lspr.GetStorageSpaces() {
|
||||
d, err := g.cs3StorageSpaceToDrive(r.Context(), wdu, sp)
|
||||
if err != nil {
|
||||
g.logger.Err(err).Interface("query", r.URL.Query()).Msg("error converting space to drive")
|
||||
}
|
||||
if slices.Contains(sel, "drive") || slices.Contains(exp, "drive") {
|
||||
if *d.DriveType == "personal" {
|
||||
drives = append(drives, *d)
|
||||
}
|
||||
} else {
|
||||
drives = append(drives, *d)
|
||||
}
|
||||
}
|
||||
user.Drives = drives
|
||||
}
|
||||
|
||||
render.Status(r, http.StatusOK)
|
||||
render.JSON(w, r, user)
|
||||
|
||||
@@ -114,12 +114,19 @@ func (p *Provider) Search(ctx context.Context, req *searchsvc.SearchRequest) (*s
|
||||
matches := MatchArray{}
|
||||
total := int32(0)
|
||||
for _, space := range listSpacesRes.StorageSpaces {
|
||||
searchRootId := &searchmsg.ResourceID{
|
||||
StorageId: space.Root.StorageId,
|
||||
SpaceId: space.Root.SpaceId,
|
||||
OpaqueId: space.Root.OpaqueId,
|
||||
}
|
||||
var mountpointRootId *searchmsg.ResourceID
|
||||
mountpointPrefix := ""
|
||||
switch space.SpaceType {
|
||||
case "mountpoint":
|
||||
continue // mountpoint spaces are only "links" to the shared spaces. we have to search the shared "grant" space instead
|
||||
case "grant":
|
||||
// In case of grant spaces we search the root of the outer space and translate the paths to the according mountpoint
|
||||
searchRootId.OpaqueId = space.Root.SpaceId
|
||||
mountpointId, ok := mountpointMap[space.Id.OpaqueId]
|
||||
if !ok {
|
||||
p.logger.Warn().Interface("space", space).Msg("could not find mountpoint space for grant space")
|
||||
@@ -153,12 +160,8 @@ func (p *Provider) Search(ctx context.Context, req *searchsvc.SearchRequest) (*s
|
||||
res, err := p.indexClient.Search(ctx, &searchsvc.SearchIndexRequest{
|
||||
Query: formatQuery(req.Query),
|
||||
Ref: &searchmsg.Reference{
|
||||
ResourceId: &searchmsg.ResourceID{
|
||||
StorageId: space.Root.StorageId,
|
||||
SpaceId: space.Root.SpaceId,
|
||||
OpaqueId: space.Root.OpaqueId,
|
||||
},
|
||||
Path: mountpointPrefix,
|
||||
ResourceId: searchRootId,
|
||||
Path: mountpointPrefix,
|
||||
},
|
||||
PageSize: req.PageSize,
|
||||
})
|
||||
|
||||
@@ -49,8 +49,8 @@ var _ = Describe("Searchprovider", func() {
|
||||
},
|
||||
},
|
||||
},
|
||||
Id: &sprovider.StorageSpaceId{OpaqueId: "personalspace"},
|
||||
Root: &sprovider.ResourceId{StorageId: "storageid", OpaqueId: "storageid"},
|
||||
Id: &sprovider.StorageSpaceId{OpaqueId: "storageid$personalspace!personalspace"},
|
||||
Root: &sprovider.ResourceId{StorageId: "storageid", SpaceId: "personalspace", OpaqueId: "storageid"},
|
||||
Name: "personalspace",
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ var _ = Describe("Searchprovider", func() {
|
||||
Ref: &searchmsg.Reference{
|
||||
ResourceId: &searchmsg.ResourceID{
|
||||
StorageId: personalSpace.Root.StorageId,
|
||||
SpaceId: personalSpace.Root.SpaceId,
|
||||
OpaqueId: personalSpace.Root.OpaqueId,
|
||||
},
|
||||
Path: "./path/to/Foo.pdf",
|
||||
@@ -259,6 +260,7 @@ var _ = Describe("Searchprovider", func() {
|
||||
Ref: &searchmsg.Reference{
|
||||
ResourceId: &searchmsg.ResourceID{
|
||||
StorageId: grantSpace.Root.StorageId,
|
||||
SpaceId: grantSpace.Root.SpaceId,
|
||||
OpaqueId: grantSpace.Root.OpaqueId,
|
||||
},
|
||||
Path: "./grant/path/to/Shared.pdf",
|
||||
@@ -297,7 +299,8 @@ var _ = Describe("Searchprovider", func() {
|
||||
StorageSpaces: []*sprovider.StorageSpace{personalSpace, grantSpace, mountpointSpace},
|
||||
}, nil)
|
||||
indexClient.On("Search", mock.Anything, mock.MatchedBy(func(req *searchsvc.SearchIndexRequest) bool {
|
||||
return req.Ref.ResourceId.StorageId == grantSpace.Root.StorageId
|
||||
return req.Ref.ResourceId.OpaqueId == grantSpace.Root.SpaceId &&
|
||||
req.Ref.ResourceId.SpaceId == grantSpace.Root.SpaceId
|
||||
})).Return(&searchsvc.SearchIndexResponse{
|
||||
TotalMatches: 2,
|
||||
Matches: []*searchmsg.Match{
|
||||
@@ -307,6 +310,7 @@ var _ = Describe("Searchprovider", func() {
|
||||
Ref: &searchmsg.Reference{
|
||||
ResourceId: &searchmsg.ResourceID{
|
||||
StorageId: grantSpace.Root.StorageId,
|
||||
SpaceId: grantSpace.Root.SpaceId,
|
||||
OpaqueId: grantSpace.Root.OpaqueId,
|
||||
},
|
||||
Path: "./grant/path/to/Shared.pdf",
|
||||
@@ -324,6 +328,7 @@ var _ = Describe("Searchprovider", func() {
|
||||
Ref: &searchmsg.Reference{
|
||||
ResourceId: &searchmsg.ResourceID{
|
||||
StorageId: grantSpace.Root.StorageId,
|
||||
SpaceId: grantSpace.Root.SpaceId,
|
||||
OpaqueId: grantSpace.Root.OpaqueId,
|
||||
},
|
||||
Path: "./grant/path/to/Irrelevant.pdf",
|
||||
@@ -338,7 +343,8 @@ var _ = Describe("Searchprovider", func() {
|
||||
},
|
||||
}, nil)
|
||||
indexClient.On("Search", mock.Anything, mock.MatchedBy(func(req *searchsvc.SearchIndexRequest) bool {
|
||||
return req.Ref.ResourceId.StorageId == personalSpace.Root.StorageId
|
||||
return req.Ref.ResourceId.OpaqueId == personalSpace.Root.OpaqueId &&
|
||||
req.Ref.ResourceId.SpaceId == personalSpace.Root.SpaceId
|
||||
})).Return(&searchsvc.SearchIndexResponse{
|
||||
TotalMatches: 1,
|
||||
Matches: []*searchmsg.Match{
|
||||
@@ -348,6 +354,7 @@ var _ = Describe("Searchprovider", func() {
|
||||
Ref: &searchmsg.Reference{
|
||||
ResourceId: &searchmsg.ResourceID{
|
||||
StorageId: personalSpace.Root.StorageId,
|
||||
SpaceId: personalSpace.Root.SpaceId,
|
||||
OpaqueId: personalSpace.Root.OpaqueId,
|
||||
},
|
||||
Path: "./path/to/Foo.pdf",
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"de":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"de_DE":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Benutzerkonto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"el":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Λογαριασμός","Cancel":"Aκύρωση","Hello":"Γεια σας","Language":"Γλώσσα","Loading personal settings":"Γίνεται φόρτωση προσωπικών ρυθμίσεων","Loading personal settings...":"Γίνεται φόρτωση προσωπικών ρυθμίσεων...","msg":"μνμ","No settings available":"Δεν υπάρχουν διαθέσιμες ρυθμίσεις","Save":"Αποθήκευση","Settings":"Ρυθμίσεις","Settings type not implemented: %{type}":"Ο τύπος ρυθμίσεων δεν εφαρμόστηκε: %{type}"},"es":{"{{ bundle.displayName }}":"{{bundle.displayName}}","Account":"Cuenta","Cancel":"Cancelar","Hello":"Hola","Language":"Idioma","Loading personal settings":"Cargando configuraciones personales","Loading personal settings...":"Cargando configuración personal ...","msg":"msg","No settings available":"No hay configuraciones disponibles","Save":"Guardar","Settings":"Configuración","Settings type not implemented: %{type}":"Tipo de configuración no implementado: %{type}"},"pl":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Anuluj","Hello":"Witaj","Language":"Język","Loading personal settings":"Ładowanie ustawień osobistych","Loading personal settings...":"Ładowanie ustawień osobistych...","msg":"wiad","No settings available":"Brak dostępnych ustawień","Save":"Zapisz","Settings":"Ustawienia","Settings type not implemented: %{type}":"Typ ustawień nie jest wdrożony: %{type}"},"pt_BR":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Conta","Cancel":"Cancelar","Hello":"Olá","Language":"Idioma","Loading personal settings":"Carregando configurações pessoais ","Loading personal settings...":"Carregando configurações pessoais... ","msg":"msg","No settings available":"Nenhuma configuração disponível ","Save":"Salvar","Settings":"Configurações","Settings type not implemented: %{type}":"Tipo de configuração não implementado: %{type}"},"ru":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Уч.запись","Cancel":"Отмена","Hello":"Здравствуйте","Language":"Язык","Loading personal settings":"Загрузка личных настроек","Loading personal settings...":"Загрузка личных настроек…","msg":"сообщ","No settings available":"Нет доступных настроек","Save":"Сохранить","Settings":"Настройки","Settings type not implemented: %{type}":"Тип настроек не реализован: %{type}"},"sq":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Llogari","Cancel":"Anuloje","Hello":"Tungjatjeta","Language":"Gjuhë","Loading personal settings":"Ngarkim rregullimesh personale","Loading personal settings...":"Po ngarkohen rregullime personale…","msg":"msz","No settings available":"S’ka rregullime","Save":"Ruaje","Settings":"Rregullime","Settings type not implemented: %{type}":"Lloj rregullimi i pasendërtuar: %{type}"},"th_TH":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"บัญชี","Cancel":"ยกเลิก","Hello":"สวัสดี","Language":"ภาษา","Loading personal settings":"กำลังโหลดการตั้งค่าส่วนบุคคล","Loading personal settings...":"กำลังโหลดการตั้งค่าส่วนบุคคล...","msg":"msg","No settings available":"ไม่มีการตั้งค่า","Save":"บันทึก","Settings":"ตั้งค่า","Settings type not implemented: %{type}":"ประเภทการตั้งค่าที่ยังไม่ถูกดำเนินการ: %{type}"},"zh_CN":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"账户","Cancel":"取消","Hello":"你好","Language":"语言","Loading personal settings":"加载个人设置","Loading personal settingLine truncated
|
||||
{"de":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"de_DE":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Benutzerkonto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"el":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Λογαριασμός","Cancel":"Aκύρωση","Hello":"Γεια σας","Language":"Γλώσσα","Loading personal settings":"Γίνεται φόρτωση προσωπικών ρυθμίσεων","Loading personal settings...":"Γίνεται φόρτωση προσωπικών ρυθμίσεων...","msg":"μνμ","No settings available":"Δεν υπάρχουν διαθέσιμες ρυθμίσεις","Save":"Αποθήκευση","Settings":"Ρυθμίσεις","Settings type not implemented: %{type}":"Ο τύπος ρυθμίσεων δεν εφαρμόστηκε: %{type}"},"es":{"{{ bundle.displayName }}":"{{bundle.displayName}}","Account":"Cuenta","Cancel":"Cancelar","Hello":"Hola","Language":"Idioma","Loading personal settings":"Cargando configuraciones personales","Loading personal settings...":"Cargando configuración personal ...","msg":"msg","No settings available":"No hay configuraciones disponibles","Save":"Guardar","Settings":"Configuración","Settings type not implemented: %{type}":"Tipo de configuración no implementado: %{type}"},"pl":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Anuluj","Hello":"Witaj","Language":"Język","Loading personal settings":"Ładowanie ustawień osobistych","Loading personal settings...":"Ładowanie ustawień osobistych...","msg":"wiad","No settings available":"Brak dostępnych ustawień","Save":"Zapisz","Settings":"Ustawienia","Settings type not implemented: %{type}":"Typ ustawień nie jest wdrożony: %{type}"},"pt_BR":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Conta","Cancel":"Cancelar","Hello":"Olá","Language":"Idioma","Loading personal settings":"Carregando configurações pessoais ","Loading personal settings...":"Carregando configurações pessoais... ","msg":"msg","No settings available":"Nenhuma configuração disponível ","Save":"Salvar","Settings":"Configurações","Settings type not implemented: %{type}":"Tipo de configuração não implementado: %{type}"},"ru":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Уч.запись","Cancel":"Отмена","Hello":"Здравствуйте","Language":"Язык","Loading personal settings":"Загрузка личных настроек","Loading personal settings...":"Загрузка личных настроек…","msg":"сообщ","No settings available":"Нет доступных настроек","Save":"Сохранить","Settings":"Настройки","Settings type not implemented: %{type}":"Тип настроек не реализован: %{type}"},"sq":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Llogari","Cancel":"Anuloje","Hello":"Tungjatjeta","Language":"Gjuhë","Loading personal settings":"Ngarkim rregullimesh personale","Loading personal settings...":"Po ngarkohen rregullime personale…","msg":"msz","No settings available":"S’ka rregullime","Save":"Ruaje","Settings":"Rregullime","Settings type not implemented: %{type}":"Lloj rregullimi i pasendërtuar: %{type}"},"th_TH":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"บัญชี","Cancel":"ยกเลิก","Hello":"สวัสดี","Language":"ภาษา","Loading personal settings":"กำลังโหลดการตั้งค่าส่วนบุคคล","Loading personal settings...":"กำลังโหลดการตั้งค่าส่วนบุคคล...","msg":"msg","No settings available":"ไม่มีการตั้งค่า","Save":"บันทึก","Settings":"ตั้งค่า","Settings type not implemented: %{type}":"ประเภทการตั้งค่าที่ยังไม่ถูกดำเนินการ: %{type}"},"tr":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Hesap","Cancel":"İptal","Hello":"Merhaba","Language":"Dil","Loading personal settings":"Kişisel ayarlar yükleniyor","Loading personal setLine truncated
|
||||
Reference in new issue
Block a user