-
Notifications
You must be signed in to change notification settings - Fork 386
/
settings.go
139 lines (129 loc) · 4.63 KB
/
settings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Copyright (C) 2024 Storj Labs, Inc.
// See LICENSE for copying information.
package admin
import (
"context"
"storj.io/storj/private/api"
)
// Settings contains relevant settings for the consumers of this service. It may contain settings
// of:
//
// - this service.
//
// - the server that exposes the service.
//
// - related Storj services (e.g. Satellite).
type Settings struct {
Admin SettingsAdmin `json:"admin"`
}
// SettingsAdmin are the settings of this service and the server that exposes it.
type SettingsAdmin struct {
Features FeatureFlags `json:"features"`
}
// FeatureFlags indicates what Admin service features are enabled or disabled. The features are
// usually disabled when they are not fully implemented.
type FeatureFlags struct {
Account AccountFlags `json:"account"`
Project ProjectFlags `json:"project"`
Bucket BucketFlags `json:"bucket"`
Dashboard bool `json:"dashboard"`
Operator bool `json:"operator"` // This is the information about the logged operator
SignOut bool `json:"signOut"`
SwitchSatellite bool `json:"switchSatellite"`
}
// AccountFlags are the feature flags related to user's accounts.
type AccountFlags struct {
Create bool `json:"create"`
Delete bool `json:"delete"`
History bool `json:"history"`
List bool `json:"list"`
Projects bool `json:"projects"`
Suspend bool `json:"suspend"`
Unsuspend bool `json:"unsuspend"`
ResetMFA bool `json:"resetMFA"`
UpdateInfo bool `json:"updateInfo"`
UpdateLimits bool `json:"updateLimits"`
UpdatePlacement bool `json:"updatePlacement"`
UpdateStatus bool `json:"updateStatus"`
UpdateValueAttribution bool `json:"updateValueAttribution"`
View bool `json:"view"`
}
// ProjectFlags are the feature flags related to projects.
type ProjectFlags struct {
Create bool `json:"create"`
Delete bool `json:"delete"`
History bool `json:"history"`
List bool `json:"list"`
UpdateInfo bool `json:"updateInfo"`
UpdateLimits bool `json:"updateLimits"`
UpdatePlacement bool `json:"updatePlacement"`
UpdateValueAttribution bool `json:"updateValueAttribution"`
View bool `json:"view"`
MemberList bool `json:"memberList"`
MemberAdd bool `json:"memberAdd"`
MemberRemove bool `json:"memberRemove"`
}
// BucketFlags are the feature flags related to buckets.
type BucketFlags struct {
Create bool `json:"create"`
Delete bool `json:"delete"`
History bool `json:"history"`
List bool `json:"list"`
UpdateInfo bool `json:"updateInfo"`
UpdatePlacement bool `json:"updatePlacement"`
UpdateValueAttribution bool `json:"updateValueAttribution"`
View bool `json:"view"`
}
// GetSettings returns the service settings.
func (s *Service) GetSettings(ctx context.Context) (*Settings, api.HTTPError) {
return &Settings{
Admin: SettingsAdmin{
Features: FeatureFlags{
Account: AccountFlags{
Create: false,
Delete: false,
History: false,
List: false,
Projects: true,
Suspend: false,
Unsuspend: false,
ResetMFA: false,
UpdateInfo: false,
UpdateLimits: false,
UpdatePlacement: false,
UpdateStatus: false,
UpdateValueAttribution: false,
View: true,
},
Project: ProjectFlags{
Create: false,
Delete: false,
History: false,
List: false,
UpdateInfo: false,
UpdateLimits: false,
UpdatePlacement: false,
UpdateValueAttribution: false,
View: false,
MemberList: false,
MemberAdd: false,
MemberRemove: false,
},
Bucket: BucketFlags{
Create: false,
Delete: false,
History: false,
List: false,
UpdateInfo: false,
UpdatePlacement: false,
UpdateValueAttribution: false,
View: false,
},
Dashboard: false,
Operator: false,
SignOut: false,
SwitchSatellite: false,
},
},
}, api.HTTPError{}
}