1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 21:15:24 +02:00

Provider sample data for Cloud onboarding

This commit is contained in:
sauls8t 2019-06-29 15:37:49 +01:00
parent 201d2a339c
commit 69077ce419
7 changed files with 1201 additions and 1100 deletions

View file

@ -13,6 +13,8 @@ package meta
import (
"database/sql"
"fmt"
"github.com/documize/community/model/doc"
"github.com/documize/community/domain"
@ -29,9 +31,14 @@ type Store struct {
}
// Documents returns every document ID value stored.
// The query runs at the instance level across all tenants.
// For global admins, the query runs at the instance level across all tenants.
// For tenant admins, the query is restricted to the tenant.
func (s Store) Documents(ctx domain.RequestContext) (documents []string, err error) {
err = s.Runtime.Db.Select(&documents, `SELECT c_refid FROM dmz_doc WHERE c_lifecycle=1`)
qry := "SELECT c_refid FROM dmz_doc WHERE c_lifecycle=1"
if !ctx.GlobalAdmin {
qry = fmt.Sprintf("%s AND c_orgid='%s'", qry, ctx.OrgID)
}
err = s.Runtime.Db.Select(&documents, qry)
if err == sql.ErrNoRows {
err = nil