community: github.com/documize/community/domain Index | Files | Directories

package domain

import "github.com/documize/community/domain"

Package domain defines data structures for moving data between services.

Index

Package Files

context.go product.go

Constants

const (
    // CommunityEdition is AGPL licensed open core of product.
    CommunityEdition Edition = "Community"

    // EnterpriseEdition is proprietary closed-source product.
    EnterpriseEdition Edition = "Enterprise"

    // PackageEssentials provides core capabilities.
    PackageEssentials Package = "Essentials"

    // PackageAdvanced provides analytics, reporting,
    // content lifecycle, content verisoning, and audit logs.
    PackageAdvanced Package = "Advanced"

    // PackagePremium provides actions, feedback capture,
    // approvals workflow, secure external sharing.
    PackagePremium Package = "Premium"

    // PackageDataCenter provides multi-tenanting
    // and a bunch of professional services.
    PackageDataCenter Package = "Data Center"

    // PlanCloud represents *.documize.com hosting.
    PlanCloud Plan = "Cloud"

    // PlanSelfHost represents privately hosted Documize instance.
    PlanSelfHost Plan = "Self-host"

    // Seats0 is 0 users.
    Seats0 Seats = 0

    // Seats1 is 10 users.
    Seats1 Seats = 10

    // Seats2 is 25 users.
    Seats2 Seats = 25

    //Seats3 is 50 users.
    Seats3 Seats = 50

    // Seats4 is 100 users.
    Seats4 Seats = 100

    //Seats5 is 250 users.
    Seats5 Seats = 250

    // Seats6 is unlimited.
    Seats6 Seats = 9999
)
const DocumizeContextKey key = "documize context key"

DocumizeContextKey prevents key name collisions.

func SubscriptionAsXML Uses

func SubscriptionAsXML(j SubscriptionData) (b []byte, err error)

SubscriptionAsXML returns subscription data as XML document:

<DocumizeLicense>

<Key>some key</Key>
<Signature>some signature</Signature>

</DocumizeLicense>

XML document is empty in case of error.

type Edition Uses

type Edition string

Edition is either Community or Enterprise.

type Package Uses

type Package string

Package controls feature-set within edition.

type Plan Uses

type Plan string

Plan tells us if instance if self-hosted or Documize SaaS/Cloud.

type Product Uses

type Product struct {
    Edition  Edition
    Title    string
    Version  string
    Major    string
    Minor    string
    Patch    string
    Revision string

    // UserCount is number of users within Documize instance by tenant.
    UserCount map[string]int
}

Product provides product meta information and handles subscription validation for Enterprise edition.

func (*Product) IsValid Uses

func (p *Product) IsValid(ctx RequestContext) bool

IsValid returns if subscription is valid using RequestContext.

type RequestContext Uses

type RequestContext struct {
    AllowAnonymousAccess bool
    Authenticated        bool
    Guest                bool
    UserID               string
    OrgID                string
    OrgName              string
    SSL                  bool
    AppURL               string // e.g. https://{url}.documize.com
    Subdomain            string
    ClientIP             string
    Expires              time.Time
    Fullname             string
    Transaction          *sqlx.Tx
    Administrator        bool
    Analytics            bool
    Active               bool
    Editor               bool
    GlobalAdmin          bool
    ViewUsers            bool
    Subscription         Subscription
}

RequestContext provides per request scoped values required for HTTP handlers.

func GetRequestContext Uses

func GetRequestContext(r *http.Request) (ctx RequestContext)

GetRequestContext returns RequestContext from context.Context

func (*RequestContext) GetAppURL Uses

func (c *RequestContext) GetAppURL(endpoint string) string

GetAppURL returns full HTTP url for the app

type Seats Uses

type Seats int

Seats represents number of users.

type Subscription Uses

type Subscription struct {
    ID      string    `json:"id"`
    Name    string    `json:"name"`
    Email   string    `json:"email"`
    Edition Edition   `json:"edition"`
    Plan    Plan      `json:"plan"`
    Start   time.Time `json:"start"`
    End     time.Time `json:"end"`
    Seats   Seats     `json:"seats"`
    Trial   bool      `json:"trial"`
    Price   uint64    `json:"price"`
    // Derived fields
    ActiveUsers int `json:"activeUsers"`
    Status      int `json:"status"`
}

Subscription data for customer.

func DecodeSubscription Uses

func DecodeSubscription(sd SubscriptionData) (sub Subscription, err error)

DecodeSubscription returns Documize issued product licensing information.

func (*Subscription) IsEmpty Uses

func (s *Subscription) IsEmpty() bool

IsEmpty determines if we have a license.

type SubscriptionData Uses

type SubscriptionData struct {
    Key       string `json:"key"`
    Signature string `json:"signature"`
}

SubscriptionData holds encrypted data and is unpacked into Subscription.

type SubscriptionUserAccount Uses

type SubscriptionUserAccount struct {
    OrgID string `json:"orgId"`
    Users int    `json:"users"`
}

SubscriptionUserAccount states number of active users by tenant.

type SubscriptionXML Uses

type SubscriptionXML struct {
    XMLName   xml.Name `xml:"Documize"`
    Key       string
    Signature string
}

SubscriptionXML represents subscription data as XML document.

Directories

PathSynopsis
account
activity
attachment
auditPackage audit records user events.
auth
auth/cas
auth/keycloak
auth/ldap
backupPackage backup handle data backup/restore to/from ZIP format.
block
categoryPackage category handles API calls and persistence for categories.
conversion
conversion/storePackage store provides the implementation for a file system based storage provider.
document
group
label
link
mail
meta
onboardPackage onboard handles the setup of sample data for a new Documize instance.
organization
page
permissionPackage permission handles API calls and persistence for spaces.
pin
search
section
section/airtable
section/code
section/flowchart
section/gemini
section/github
section/jira
section/markdown
section/papertrail
section/pdfjs
section/plantuml
section/provider
section/table
section/tabular
section/trello
section/wysiwyg
settingPackage setting manages both global and user level settings
smtpPackage smtp provides access to SMTP server for sending email.
spacePackage space handles API calls and persistence for spaces.
store
template
user

Package domain imports 14 packages (graph) and is imported by 39 packages. Updated 2019-11-17. Refresh now. Tools for package owners.