Skip to content

Commit 989e6f3

Browse files
bexsoftBenjamin Perez
andauthored
Added Service Accounts page to settings (#128)
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent 35d575e commit 989e6f3

30 files changed

+997
-1522
lines changed

pkg/acl/endpoints.go

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ import iampolicy "github.com/minio/minio/pkg/iam/policy"
2020

2121
// endpoints definition
2222
var (
23-
configuration = "/configurations-list"
24-
users = "/users"
25-
groups = "/groups"
26-
iamPolicies = "/policies"
27-
dashboard = "/dashboard"
28-
profiling = "/profiling"
29-
trace = "/trace"
30-
logs = "/logs"
31-
watch = "/watch"
32-
notifications = "/notification-endpoints"
33-
buckets = "/buckets"
23+
configuration = "/configurations-list"
24+
users = "/users"
25+
groups = "/groups"
26+
iamPolicies = "/policies"
27+
dashboard = "/dashboard"
28+
profiling = "/profiling"
29+
trace = "/trace"
30+
logs = "/logs"
31+
watch = "/watch"
32+
notifications = "/notification-endpoints"
33+
buckets = "/buckets"
34+
serviceAccounts = "/service-accounts"
3435
)
3536

3637
type ConfigurationActionSet struct {
@@ -179,19 +180,26 @@ var bucketsActionSet = ConfigurationActionSet{
179180
),
180181
}
181182

183+
// serviceAccountsActionSet contains the list of admin actions required for this endpoint to work
184+
var serviceAccountsActionSet = ConfigurationActionSet{
185+
actionTypes: iampolicy.NewActionSet(),
186+
actions: iampolicy.NewActionSet(),
187+
}
188+
182189
// endpointRules contains the mapping between endpoints and ActionSets, additional rules can be added here
183190
var endpointRules = map[string]ConfigurationActionSet{
184-
configuration: configurationActionSet,
185-
users: usersActionSet,
186-
groups: groupsActionSet,
187-
iamPolicies: iamPoliciesActionSet,
188-
dashboard: dashboardActionSet,
189-
profiling: profilingActionSet,
190-
trace: traceActionSet,
191-
logs: logsActionSet,
192-
watch: watchActionSet,
193-
notifications: notificationsActionSet,
194-
buckets: bucketsActionSet,
191+
configuration: configurationActionSet,
192+
users: usersActionSet,
193+
groups: groupsActionSet,
194+
iamPolicies: iamPoliciesActionSet,
195+
dashboard: dashboardActionSet,
196+
profiling: profilingActionSet,
197+
trace: traceActionSet,
198+
logs: logsActionSet,
199+
watch: watchActionSet,
200+
notifications: notificationsActionSet,
201+
buckets: bucketsActionSet,
202+
serviceAccounts: serviceAccountsActionSet,
195203
}
196204

197205
// GetActionsStringFromPolicy extract the admin/s3 actions from a given policy and return them in []string format

pkg/acl/endpoints_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
3737
args: args{
3838
[]string{"admin:ServerInfo"},
3939
},
40-
want: 1,
40+
want: 2,
4141
},
4242
{
4343
name: "policies endpoint",
@@ -50,7 +50,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
5050
"admin:ListUserPolicies",
5151
},
5252
},
53-
want: 1,
53+
want: 2,
5454
},
5555
{
5656
name: "all admin endpoints",
@@ -59,7 +59,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
5959
"admin:*",
6060
},
6161
},
62-
want: 9,
62+
want: 10,
6363
},
6464
{
6565
name: "all s3 endpoints",
@@ -68,7 +68,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
6868
"s3:*",
6969
},
7070
},
71-
want: 2,
71+
want: 3,
7272
},
7373
{
7474
name: "all admin and s3 endpoints",
@@ -78,7 +78,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
7878
"s3:*",
7979
},
8080
},
81-
want: 11,
81+
want: 12,
8282
},
8383
{
8484
name: "no endpoints",

portal-ui/bindata_assetfs.go

Lines changed: 98 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

portal-ui/src/Routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const isLoggedIn = () => {
3535
};
3636

3737
const mapState = (state: AppState) => ({
38-
loggedIn: state.system.loggedIn
38+
loggedIn: state.system.loggedIn,
3939
});
4040

4141
const connector = connect(mapState, { userLoggedIn });

portal-ui/src/common/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export class API {
2424
return request(method, url)
2525
.set("Authorization", `Bearer ${token}`)
2626
.send(data)
27-
.then(res => res.body)
28-
.catch(err => {
27+
.then((res) => res.body)
28+
.catch((err) => {
2929
// if we get unauthorized, kick out the user
3030
if (err.status === 401) {
3131
storage.removeItem("token");

portal-ui/src/screens/Console/Configurations/ConfigurationPanels/ConfigurationsList.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,36 @@ interface IListConfiguration {
3535
const styles = (theme: Theme) =>
3636
createStyles({
3737
errorBlock: {
38-
color: "red"
38+
color: "red",
3939
},
4040
strongText: {
41-
fontWeight: 700
41+
fontWeight: 700,
4242
},
4343
keyName: {
44-
marginLeft: 5
44+
marginLeft: 5,
4545
},
4646
actionsTray: {
4747
textAlign: "right",
4848
"& button": {
49-
marginLeft: 10
50-
}
49+
marginLeft: 10,
50+
},
5151
},
5252
searchField: {
5353
background: "#FFFFFF",
5454
padding: 12,
5555
borderRadius: 5,
56-
boxShadow: "0px 3px 6px #00000012"
56+
boxShadow: "0px 3px 6px #00000012",
5757
},
5858
iconText: {
59-
lineHeight: "24px"
60-
}
59+
lineHeight: "24px",
60+
},
6161
});
6262

6363
const ConfigurationsList = ({ classes }: IListConfiguration) => {
6464
const [editScreenOpen, setEditScreenOpen] = useState(false);
6565
const [selectedConfiguration, setSelectedConfiguration] = useState({
6666
configuration_id: "",
67-
configuration_label: ""
67+
configuration_label: "",
6868
});
6969
const [error, setError] = useState("");
7070
const [filter, setFilter] = useState("");
@@ -81,12 +81,12 @@ const ConfigurationsList = ({ classes }: IListConfiguration) => {
8181
setSelectedConfiguration(element);
8282
setEditScreenOpen(true);
8383
}
84-
}
85-
}
84+
},
85+
},
8686
];
8787

8888
const filteredRecords: IConfigurationElement[] = configurationElements.filter(
89-
elementItem =>
89+
(elementItem) =>
9090
elementItem.configuration_id
9191
.toLocaleLowerCase()
9292
.includes(filter.toLocaleLowerCase())
@@ -117,7 +117,7 @@ const ConfigurationsList = ({ classes }: IListConfiguration) => {
117117
className={classes.searchField}
118118
id="search-resource"
119119
label=""
120-
onChange={event => {
120+
onChange={(event) => {
121121
setFilter(event.target.value);
122122
}}
123123
InputProps={{
@@ -126,7 +126,7 @@ const ConfigurationsList = ({ classes }: IListConfiguration) => {
126126
<InputAdornment position="start">
127127
<SearchIcon />
128128
</InputAdornment>
129-
)
129+
),
130130
}}
131131
/>
132132
</Grid>
@@ -137,7 +137,7 @@ const ConfigurationsList = ({ classes }: IListConfiguration) => {
137137
<TableWrapper
138138
itemActions={tableActions}
139139
columns={[
140-
{ label: "Configuration", elementKey: "configuration_id" }
140+
{ label: "Configuration", elementKey: "configuration_id" },
141141
]}
142142
isLoading={false}
143143
records={filteredRecords}

portal-ui/src/screens/Console/Configurations/ConfigurationPanels/WebhookPanel.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,29 @@ interface IWebhook {
4444
const styles = (theme: Theme) =>
4545
createStyles({
4646
errorBlock: {
47-
color: "red"
47+
color: "red",
4848
},
4949
strongText: {
50-
fontWeight: 700
50+
fontWeight: 700,
5151
},
5252
keyName: {
53-
marginLeft: 5
53+
marginLeft: 5,
5454
},
5555
actionsTray: {
5656
textAlign: "right",
5757
"& button": {
58-
marginLeft: 10
59-
}
58+
marginLeft: 10,
59+
},
6060
},
6161
searchField: {
6262
background: "#FFFFFF",
6363
padding: 12,
6464
borderRadius: 5,
65-
boxShadow: "0px 3px 6px #00000012"
65+
boxShadow: "0px 3px 6px #00000012",
6666
},
6767
iconText: {
68-
lineHeight: "24px"
69-
}
68+
lineHeight: "24px",
69+
},
7070
});
7171

7272
const panels = {
@@ -77,8 +77,8 @@ const panels = {
7777
apiURL: "",
7878
configuration: {
7979
configuration_id: "logger_webhook",
80-
configuration_label: "Logger Webhook"
81-
}
80+
configuration_label: "Logger Webhook",
81+
},
8282
},
8383
audit: {
8484
main: "audit",
@@ -87,9 +87,9 @@ const panels = {
8787
apiURL: "",
8888
configuration: {
8989
configuration_id: "audit_webhook",
90-
configuration_label: "Audit Webhook"
91-
}
92-
}
90+
configuration_label: "Audit Webhook",
91+
},
92+
},
9393
};
9494

9595
const WebhookPanel = ({ match, classes }: IWebhookPanel) => {
@@ -107,15 +107,15 @@ const WebhookPanel = ({ match, classes }: IWebhookPanel) => {
107107
return null;
108108
}
109109

110-
const filteredRecords: IWebhook[] = webhooks.filter(elementItem =>
110+
const filteredRecords: IWebhook[] = webhooks.filter((elementItem) =>
111111
elementItem.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())
112112
);
113113

114114
const tableActions = [
115115
{
116116
type: "edit",
117-
onClick: () => {}
118-
}
117+
onClick: () => {},
118+
},
119119
];
120120

121121
return (
@@ -144,7 +144,7 @@ const WebhookPanel = ({ match, classes }: IWebhookPanel) => {
144144
className={classes.searchField}
145145
id="search-resource"
146146
label=""
147-
onChange={event => {
147+
onChange={(event) => {
148148
setFilter(event.target.value);
149149
}}
150150
InputProps={{
@@ -153,7 +153,7 @@ const WebhookPanel = ({ match, classes }: IWebhookPanel) => {
153153
<InputAdornment position="start">
154154
<SearchIcon />
155155
</InputAdornment>
156-
)
156+
),
157157
}}
158158
/>
159159
<Button

0 commit comments

Comments
 (0)