fix: scope creator contents and bind uploads
This commit is contained in:
@@ -21,7 +21,7 @@ type Tenant struct{}
|
||||
// @Tags TenantPublic
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "Tenant ID"
|
||||
// @Param id path int64 true "Creator User ID"
|
||||
// @Param page query int false "Page"
|
||||
// @Param limit query int false "Limit"
|
||||
// @Success 200 {object} requests.Pager
|
||||
@@ -29,13 +29,13 @@ type Tenant struct{}
|
||||
// @Bind filter query
|
||||
func (t *Tenant) ListContents(ctx fiber.Ctx, id int64, filter *dto.ContentListFilter) (*requests.Pager, error) {
|
||||
tenantID := getTenantID(ctx)
|
||||
if tenantID > 0 && id != tenantID {
|
||||
return nil, errorx.ErrForbidden.WithMsg("租户不匹配")
|
||||
}
|
||||
if filter == nil {
|
||||
filter = &dto.ContentListFilter{}
|
||||
}
|
||||
filter.TenantID = &tenantID
|
||||
if tenantID > 0 {
|
||||
filter.TenantID = &tenantID
|
||||
}
|
||||
filter.AuthorID = &id
|
||||
return services.Content.List(ctx, tenantID, filter)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user