Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[full-ci] experimental tags backport #5227

Merged
merged 2 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog/unreleased/add-global-vars-extrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Enhancement: add global env variable extractor
We have added a little tool that will extract global env vars, that are loaded
only through os.Getenv for documentation purposes

https://github.com/owncloud/ocis/issues/4916
https://github.com/owncloud/ocis/pull/5164
https://github.com/owncloud/ocis/issues/4916
5 changes: 3 additions & 2 deletions changelog/unreleased/enhancement-search.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Bugfix: Enhancement search
Enhancement: extended search

Provides multiple enhancement to the current search implementation.
Provides multiple enhancement to the search implementation.
* content extraction, search now supports apache tika to extract resource contents.
* search engine, underlying search engine is swappable now.
* event consumers, the number of event consumers can now be set, which improves the speed of the individual tasks

https://github.com/owncloud/ocis/pull/5221
https://github.com/owncloud/ocis/issues/5184
8 changes: 8 additions & 0 deletions changelog/unreleased/enhancement-tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enhancement: resource tags

We've added the ability to tag resources via the graph api.
Tags can be added (put request) and removed (delete request) from a resource,
a list of available tags can also be requested by sending a get request to the graph endpoint.

https://github.com/owncloud/ocis/pull/5227
https://github.com/owncloud/ocis/issues/5184
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/blevesearch/bleve/v2 v2.3.5
github.com/coreos/go-oidc/v3 v3.4.0
github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965
github.com/cs3org/reva/v2 v2.12.1-0.20221214090401-47e0591bb902
github.com/cs3org/reva/v2 v2.12.1-0.20221215082748-05a97d63f308
github.com/disintegration/imaging v1.6.2
github.com/ggwhite/go-masker v1.0.9
github.com/go-chi/chi/v5 v5.0.7
Expand Down Expand Up @@ -54,7 +54,7 @@ require (
github.com/onsi/ginkgo/v2 v2.5.0
github.com/onsi/gomega v1.24.1
github.com/orcaman/concurrent-map v1.0.0
github.com/owncloud/libre-graph-api-go v1.0.0
github.com/owncloud/libre-graph-api-go v1.0.1-0.20221216081114-57ab57ed98b0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
github.com/rs/zerolog v1.28.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4=
github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A=
github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965 h1:y4n2j68LLnvac+zw/al8MfPgO5aQiIwLmHM/JzYN8AM=
github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva/v2 v2.12.1-0.20221214090401-47e0591bb902 h1:r8K9y0RMFXjQlrbx17iQziWYhNyAYmh70ixaXbQHsHY=
github.com/cs3org/reva/v2 v2.12.1-0.20221214090401-47e0591bb902/go.mod h1:GpocVB1w6yxeSr1VBsO9jztmt1SyNC4lCwudLwDzxHQ=
github.com/cs3org/reva/v2 v2.12.1-0.20221215082748-05a97d63f308 h1:9MePXhcJ39iQGnI7ojNlqrFrPv8B+dCa4EnlGtQEbn4=
github.com/cs3org/reva/v2 v2.12.1-0.20221215082748-05a97d63f308/go.mod h1:GpocVB1w6yxeSr1VBsO9jztmt1SyNC4lCwudLwDzxHQ=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
Expand Down Expand Up @@ -1054,8 +1054,8 @@ github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35uk
github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HDbW65HOY=
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA=
github.com/owncloud/libre-graph-api-go v1.0.0 h1:3uu5Thr9uxRkF6yak91TKydtvvvG8j9LbfirYIh+hcM=
github.com/owncloud/libre-graph-api-go v1.0.0/go.mod h1:579sFrPP7aP24LZXGPopLfvE+hAka/2DYHk0+Ij+w+U=
github.com/owncloud/libre-graph-api-go v1.0.1-0.20221216081114-57ab57ed98b0 h1:47N8o/5MmQ5781dF44fk1lQtyFmTAvu6/5hPG3rM1TQ=
github.com/owncloud/libre-graph-api-go v1.0.1-0.20221216081114-57ab57ed98b0/go.mod h1:579sFrPP7aP24LZXGPopLfvE+hAka/2DYHk0+Ij+w+U=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
Expand Down
35 changes: 22 additions & 13 deletions protogen/gen/ocis/messages/search/v0/search.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions protogen/gen/ocis/messages/settings/v0/settings.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions protogen/gen/ocis/services/search/v0/search.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@
},
"parentId": {
"$ref": "#/definitions/v0ResourceID"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
Expand Down
1 change: 1 addition & 0 deletions protogen/proto/ocis/messages/search/v0/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ message Entity {
bool deleted = 10;
string shareRootName = 11;
ResourceID parent_id = 12;
repeated string tags = 13;
}

message Match {
Expand Down
2 changes: 2 additions & 0 deletions services/graph/pkg/server/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/v2/ocis-pkg/service/http"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
searchsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
graphMiddleware "github.com/owncloud/ocis/v2/services/graph/pkg/middleware"
svc "github.com/owncloud/ocis/v2/services/graph/pkg/service/v0"
Expand Down Expand Up @@ -129,6 +130,7 @@ func Server(opts ...Option) (http.Service, error) {
svc.WithRoleService(roleService),
svc.WithRequireAdminMiddleware(requireAdminMiddleware),
svc.WithGatewayClient(gatewayClient),
svc.WithSearchService(searchsvc.NewSearchProviderService("com.owncloud.api.search", grpc.DefaultClient())),
)

if handle == nil {
Expand Down
3 changes: 3 additions & 0 deletions services/graph/pkg/service/v0/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/go-chi/chi/v5"
"github.com/jellydator/ttlcache/v2"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
searchsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
Expand Down Expand Up @@ -57,6 +58,7 @@ type GatewayClient interface {
// MUST return CODE_NOT_FOUND if the reference does not exist
// MUST return CODE_RESOURCE_EXHAUSTED on exceeded quota limits.
GetQuota(ctx context.Context, in *gateway.GetQuotaRequest, opts ...grpc.CallOption) (*provider.GetQuotaResponse, error)
SetArbitraryMetadata(ctx context.Context, request *provider.SetArbitraryMetadataRequest, opts ...grpc.CallOption) (*provider.SetArbitraryMetadataResponse, error)
}

// Publisher is the interface for events publisher
Expand Down Expand Up @@ -97,6 +99,7 @@ type Graph struct {
permissionsService Permissions
spacePropertiesCache *ttlcache.Cache
eventsPublisher events.Publisher
searchService searchsvc.SearchProviderService
}

// ServeHTTP implements the Service interface.
Expand Down
15 changes: 15 additions & 0 deletions services/graph/pkg/service/v0/instrument.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,18 @@ func (i instrument) CreateDrive(w http.ResponseWriter, r *http.Request) {
func (i instrument) GetRootDriveChildren(w http.ResponseWriter, r *http.Request) {
i.next.GetRootDriveChildren(w, r)
}

// GetTags implements the Service interface.
func (i instrument) GetTags(w http.ResponseWriter, r *http.Request) {
i.next.GetTags(w, r)
}

// AssignTags implements the Service interface.
func (i instrument) AssignTags(w http.ResponseWriter, r *http.Request) {
i.next.AssignTags(w, r)
}

// UnassignTags implements the Service interface.
func (i instrument) UnassignTags(w http.ResponseWriter, r *http.Request) {
i.next.UnassignTags(w, r)
}
15 changes: 15 additions & 0 deletions services/graph/pkg/service/v0/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,18 @@ func (l logging) CreateDrive(w http.ResponseWriter, r *http.Request) {
func (l logging) GetRootDriveChildren(w http.ResponseWriter, r *http.Request) {
l.next.GetRootDriveChildren(w, r)
}

// GetTags implements the Service interface.
func (l logging) GetTags(w http.ResponseWriter, r *http.Request) {
l.next.GetTags(w, r)
}

// AssignTags implements the Service interface.
func (l logging) AssignTags(w http.ResponseWriter, r *http.Request) {
l.next.AssignTags(w, r)
}

// UnassignTags implements the Service interface.
func (l logging) UnassignTags(w http.ResponseWriter, r *http.Request) {
l.next.UnassignTags(w, r)
}
9 changes: 9 additions & 0 deletions services/graph/pkg/service/v0/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/cs3org/reva/v2/pkg/events"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/roles"
searchsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
Expand All @@ -26,6 +27,7 @@ type Options struct {
PermissionService Permissions
RoleManager *roles.Manager
EventsPublisher events.Publisher
SearchService searchsvc.SearchProviderService
}

// newOptions initializes the available default options.
Expand Down Expand Up @@ -88,6 +90,13 @@ func WithRoleService(val RoleService) Option {
}
}

// WithRoleService provides a function to set the RoleService option.
func WithSearchService(val searchsvc.SearchProviderService) Option {
return func(o *Options) {
o.SearchService = val
}
}

// PermissionService provides a function to set the PermissionService option.
func PermissionService(val settingssvc.PermissionService) Option {
return func(o *Options) {
Expand Down
10 changes: 10 additions & 0 deletions services/graph/pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ type Service interface {
CreateDrive(w http.ResponseWriter, r *http.Request)
UpdateDrive(w http.ResponseWriter, r *http.Request)
DeleteDrive(w http.ResponseWriter, r *http.Request)

GetTags(w http.ResponseWriter, r *http.Request)
AssignTags(w http.ResponseWriter, r *http.Request)
UnassignTags(w http.ResponseWriter, r *http.Request)
}

// NewService returns a service implementation for Service.
Expand All @@ -69,6 +73,7 @@ func NewService(opts ...Option) Service {
spacePropertiesCache: ttlcache.NewCache(),
eventsPublisher: options.EventsPublisher,
gatewayClient: options.GatewayClient,
searchService: options.SearchService,
}

if options.IdentityBackend == nil {
Expand Down Expand Up @@ -167,6 +172,11 @@ func NewService(opts ...Option) Service {
m.Route(options.Config.HTTP.Root, func(r chi.Router) {
r.Use(middleware.StripSlashes)
r.Route("/v1.0", func(r chi.Router) {
r.Route("/extensions/org.libregraph", func(r chi.Router) {
r.Get("/tags", svc.GetTags)
r.Put("/tags", svc.AssignTags)
r.Delete("/tags", svc.UnassignTags)
})
r.Route("/me", func(r chi.Router) {
r.Get("/", svc.GetMe)
r.Get("/drives", svc.GetDrives)
Expand Down
Loading