Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultValidityPeriod = 365 // default validity period in days FeatureComponents Feature = "components" // allow components FeatureCustomStatuses Feature = "custom_statuses" // allow custom statuses FeatureCustomFields Feature = "custom_fields" // allow custom fields FeatureMultipleAssignees Feature = "multiple_assignees" // allow multiple assignees per task FeatureReleases Feature = "releases" // allow releases QuotaDocuments Quota = "documents" // number of documents QuotaNamespaces Quota = "namespaces" // number of namespaces QuotaOrganizations Quota = "organizations" // number of organizations QuotaProjects Quota = "projects" // number of projects QuotaRoles Quota = "roles" // number of roles QuotaUsers Quota = "users" // number of users )
Variables ¶
View Source
var ( ErrLicenseExpired = errors.New("license expired") // license is expired ErrLicenseInvalid = errors.New("invalid or expired license provided") // license is expired ErrLicenseInvalidSignature = errors.New("invalid license signature") // license signature is invalid ErrNoLicense = errors.New("no license provided") // no license provided // DefaultFeatures is the default set of features for a license. DefaultFeatures = []Feature{ FeatureComponents, FeatureCustomStatuses, FeatureCustomFields, FeatureMultipleAssignees, FeatureReleases, } // DefaultQuotas is the default set of quotas for a license. DefaultQuotas = map[Quota]uint32{ QuotaDocuments: 10, QuotaNamespaces: 1, QuotaOrganizations: 1, QuotaProjects: 10, QuotaRoles: 5, QuotaUsers: 5, } )
Functions ¶
This section is empty.
Types ¶
type License ¶
type License struct { ID xid.ID `json:"id"` // license id Email string `json:"email"` // organization email Organization string `json:"organization"` // organization name Quotas map[Quota]uint32 `json:"quotas"` // quotas Features []Feature `json:"features"` // features ExpiresAt time.Time `json:"expires_at"` // expiration time }
License represents the license information.
The license information is parsed from the license key. The license key is generated by the license server. The license is valid for a specific organization for a given period.
The license is validated locally by the hardcoded public key. The public key is used to verify the signature of the license key.
func NewLicense ¶
NewLicense validates the license key.
If the license is valid, the validated license is returned. Otherwise, an error is returned.
func (*License) HasFeature ¶
HasFeature returns true if the license has the given feature.
Click to show internal directories.
Click to hide internal directories.