Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai3
accountserver
Commits
ff91ef92
Commit
ff91ef92
authored
Jul 25, 2019
by
putro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added newsletters in types
parent
db2850a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
types.go
types.go
+18
-6
No files found.
types.go
View file @
ff91ef92
...
...
@@ -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
...
...
@@ -480,6 +481,7 @@ type Resource struct {
// set, depending on the value of 'type').
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"`
...
...
@@ -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"`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment