Commit ff91ef92 authored by putro's avatar putro

added newsletters in types

parent db2850a9
......@@ -378,6 +378,7 @@ const (
const (
ResourceTypeEmail = "email"
ResourceTypeMailingList = "list"
ResourceTypeNewsletter = "newsletter"
ResourceTypeWebsite = "web"
ResourceTypeDomain = "domain"
ResourceTypeDAV = "dav"
......@@ -395,7 +396,7 @@ const (
// Returns true if the given status is valid for the given resource type.
func isValidStatusByResourceType(rtype, rstatus string) bool {
switch rtype {
case ResourceTypeEmail, ResourceTypeMailingList:
case ResourceTypeEmail, ResourceTypeMailingList, ResourceTypeNewsletter:
switch rstatus {
case ResourceStatusActive, ResourceStatusInactive, ResourceStatusReadonly:
return true
......@@ -478,11 +479,12 @@ type Resource struct {
// Details about the specific type (only one of these can be
// set, depending on the value of 'type').
Email *Email `json:"email,omitempty"`
List *MailingList `json:"list,omitempty"`
Website *Website `json:"website,omitempty"`
DAV *WebDAV `json:"dav,omitempty"`
Database *Database `json:"database,omitempty"`
Email *Email `json:"email,omitempty"`
List *MailingList `json:"list,omitempty"`
Newsletter *Newsletter `json:"newsletter,omitempty"`
Website *Website `json:"website,omitempty"`
DAV *WebDAV `json:"dav,omitempty"`
Database *Database `json:"database,omitempty"`
}
// Copy the resource (makes a deep copy).
......@@ -498,6 +500,9 @@ func (r *Resource) Copy() *Resource {
case r.List != nil:
l := *r.List
rr.List = &l
case r.Newsletter != nil:
l := *r.Newsletter
rr.Newsletter = &l
case r.DAV != nil:
d := *r.DAV
rr.DAV = &d
......@@ -537,6 +542,13 @@ type MailingList struct {
Public bool `json:"public"`
}
// Newsletter resource attributes.
type Newsletter struct {
Admins []string `json:"admins"`
Public bool `json:"public"`
}
// WebDAV represents a hosting account.
type WebDAV struct {
UID int `json:"uid"`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment