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
Hide 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 (
...
@@ -378,6 +378,7 @@ const (
const
(
const
(
ResourceTypeEmail
=
"email"
ResourceTypeEmail
=
"email"
ResourceTypeMailingList
=
"list"
ResourceTypeMailingList
=
"list"
ResourceTypeNewsletter
=
"newsletter"
ResourceTypeWebsite
=
"web"
ResourceTypeWebsite
=
"web"
ResourceTypeDomain
=
"domain"
ResourceTypeDomain
=
"domain"
ResourceTypeDAV
=
"dav"
ResourceTypeDAV
=
"dav"
...
@@ -395,7 +396,7 @@ const (
...
@@ -395,7 +396,7 @@ const (
// Returns true if the given status is valid for the given resource type.
// Returns true if the given status is valid for the given resource type.
func
isValidStatusByResourceType
(
rtype
,
rstatus
string
)
bool
{
func
isValidStatusByResourceType
(
rtype
,
rstatus
string
)
bool
{
switch
rtype
{
switch
rtype
{
case
ResourceTypeEmail
,
ResourceTypeMailingList
:
case
ResourceTypeEmail
,
ResourceTypeMailingList
,
ResourceTypeNewsletter
:
switch
rstatus
{
switch
rstatus
{
case
ResourceStatusActive
,
ResourceStatusInactive
,
ResourceStatusReadonly
:
case
ResourceStatusActive
,
ResourceStatusInactive
,
ResourceStatusReadonly
:
return
true
return
true
...
@@ -478,11 +479,12 @@ type Resource struct {
...
@@ -478,11 +479,12 @@ type Resource struct {
// Details about the specific type (only one of these can be
// Details about the specific type (only one of these can be
// set, depending on the value of 'type').
// set, depending on the value of 'type').
Email
*
Email
`json:"email,omitempty"`
Email
*
Email
`json:"email,omitempty"`
List
*
MailingList
`json:"list,omitempty"`
List
*
MailingList
`json:"list,omitempty"`
Website
*
Website
`json:"website,omitempty"`
Newsletter
*
Newsletter
`json:"newsletter,omitempty"`
DAV
*
WebDAV
`json:"dav,omitempty"`
Website
*
Website
`json:"website,omitempty"`
Database
*
Database
`json:"database,omitempty"`
DAV
*
WebDAV
`json:"dav,omitempty"`
Database
*
Database
`json:"database,omitempty"`
}
}
// Copy the resource (makes a deep copy).
// Copy the resource (makes a deep copy).
...
@@ -498,6 +500,9 @@ func (r *Resource) Copy() *Resource {
...
@@ -498,6 +500,9 @@ func (r *Resource) Copy() *Resource {
case
r
.
List
!=
nil
:
case
r
.
List
!=
nil
:
l
:=
*
r
.
List
l
:=
*
r
.
List
rr
.
List
=
&
l
rr
.
List
=
&
l
case
r
.
Newsletter
!=
nil
:
l
:=
*
r
.
Newsletter
rr
.
Newsletter
=
&
l
case
r
.
DAV
!=
nil
:
case
r
.
DAV
!=
nil
:
d
:=
*
r
.
DAV
d
:=
*
r
.
DAV
rr
.
DAV
=
&
d
rr
.
DAV
=
&
d
...
@@ -537,6 +542,13 @@ type MailingList struct {
...
@@ -537,6 +542,13 @@ type MailingList struct {
Public
bool
`json:"public"`
Public
bool
`json:"public"`
}
}
// Newsletter resource attributes.
type
Newsletter
struct
{
Admins
[]
string
`json:"admins"`
Public
bool
`json:"public"`
}
// WebDAV represents a hosting account.
// WebDAV represents a hosting account.
type
WebDAV
struct
{
type
WebDAV
struct
{
UID
int
`json:"uid"`
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