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

Add api support to return to the download link #543

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

xxxxibo
Copy link
Contributor

@xxxxibo xxxxibo commented Jan 11, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it

feat: add api support to return to the download link

Which issue(s) this PR fixes

Fix #534

Special notes for your reviewer

13658a06a3f1781abd0bc4ce6c804354


u, err := source.Core.PresignedGetObject(ctx.Request.Context(), bucket, objectName, time.Hour*24*7, url.Values{})
if err != nil {
klog.Errorf("failed to get generate download link %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. failed to get generate download link =》two verbs here, it should be 'generate'?
  2. 24*7 hour is some too long, I think 12 hour is enough if we'll generate a new one for each API call.

@@ -749,6 +790,7 @@ func RegisterMinIOAPI(group *gin.RouterGroup, conf gqlconfig.ServerConfig) {
group.DELETE("/model/files", auth.AuthInterceptor(conf.EnableOIDC, oidc.Verifier, "delete", "models"), api.DeleteFiles)
group.GET("/model/files/stat", auth.AuthInterceptor(conf.EnableOIDC, oidc.Verifier, "get", "models"), api.StatFile)
group.GET("/model/files/download", auth.AuthInterceptor(conf.EnableOIDC, oidc.Verifier, "get", "models"), api.Download)
group.GET("/model/files/downloadlink", auth.AuthInterceptor(conf.EnableOIDC, oidc.Verifier, "get", "models"), api.GetDownloadLink)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xff-dev do we think about RBAC check for APIs? I think we just validate OIDC token for now, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth.AuthInterceptor function is to verify that the current user has get access to the model resource based on the token.

@nkwangleiGIT nkwangleiGIT merged commit 4737e37 into kubeagi:main Jan 11, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🌱 Add api to generate file download link
4 participants