Skip to content

Commit 98f897e

Browse files
bexsoftBenjamin Perez
andauthored
Added object browser main paths (#302)
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent 7afd608 commit 98f897e

File tree

5 files changed

+82
-47
lines changed

5 files changed

+82
-47
lines changed

pkg/acl/endpoints.go

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,26 @@ import (
2222

2323
// endpoints definition
2424
var (
25-
configuration = "/configurations-list"
26-
users = "/users"
27-
groups = "/groups"
28-
iamPolicies = "/policies"
29-
dashboard = "/dashboard"
30-
profiling = "/profiling"
31-
trace = "/trace"
32-
logs = "/logs"
33-
watch = "/watch"
34-
notifications = "/notification-endpoints"
35-
buckets = "/buckets"
36-
bucketsDetail = "/buckets/:bucketName"
37-
serviceAccounts = "/service-accounts"
38-
tenants = "/tenants"
39-
tenantsDetail = "/namespaces/:tenantNamespace/tenants/:tenantName"
40-
heal = "/heal"
41-
remoteBuckets = "/remote-buckets"
42-
replication = "/replication"
25+
configuration = "/configurations-list"
26+
users = "/users"
27+
groups = "/groups"
28+
iamPolicies = "/policies"
29+
dashboard = "/dashboard"
30+
profiling = "/profiling"
31+
trace = "/trace"
32+
logs = "/logs"
33+
watch = "/watch"
34+
notifications = "/notification-endpoints"
35+
buckets = "/buckets"
36+
bucketsDetail = "/buckets/:bucketName"
37+
serviceAccounts = "/service-accounts"
38+
tenants = "/tenants"
39+
tenantsDetail = "/namespaces/:tenantNamespace/tenants/:tenantName"
40+
heal = "/heal"
41+
remoteBuckets = "/remote-buckets"
42+
replication = "/replication"
43+
objectBrowser = "/object-browser/:bucket?/*"
44+
mainObjectBrowser = "/object-browser"
4345
)
4446

4547
type ConfigurationActionSet struct {
@@ -228,24 +230,32 @@ var replicationActionSet = ConfigurationActionSet{
228230
),
229231
}
230232

233+
// objectBrowserActionSet no actions needed for this module to work
234+
var objectBrowserActionSet = ConfigurationActionSet{
235+
actionTypes: iampolicy.NewActionSet(),
236+
actions: iampolicy.NewActionSet(),
237+
}
238+
231239
// endpointRules contains the mapping between endpoints and ActionSets, additional rules can be added here
232240
var endpointRules = map[string]ConfigurationActionSet{
233-
configuration: configurationActionSet,
234-
users: usersActionSet,
235-
groups: groupsActionSet,
236-
iamPolicies: iamPoliciesActionSet,
237-
dashboard: dashboardActionSet,
238-
profiling: profilingActionSet,
239-
trace: traceActionSet,
240-
logs: logsActionSet,
241-
watch: watchActionSet,
242-
notifications: notificationsActionSet,
243-
buckets: bucketsActionSet,
244-
bucketsDetail: bucketsActionSet,
245-
serviceAccounts: serviceAccountsActionSet,
246-
heal: healActionSet,
247-
remoteBuckets: remoteBucketsActionSet,
248-
replication: replicationActionSet,
241+
configuration: configurationActionSet,
242+
users: usersActionSet,
243+
groups: groupsActionSet,
244+
iamPolicies: iamPoliciesActionSet,
245+
dashboard: dashboardActionSet,
246+
profiling: profilingActionSet,
247+
trace: traceActionSet,
248+
logs: logsActionSet,
249+
watch: watchActionSet,
250+
notifications: notificationsActionSet,
251+
buckets: bucketsActionSet,
252+
bucketsDetail: bucketsActionSet,
253+
serviceAccounts: serviceAccountsActionSet,
254+
heal: healActionSet,
255+
remoteBuckets: remoteBucketsActionSet,
256+
replication: replicationActionSet,
257+
objectBrowser: objectBrowserActionSet,
258+
mainObjectBrowser: objectBrowserActionSet,
249259
}
250260

251261
// operatorRules contains the mapping between endpoints and ActionSets for operator only mode

pkg/acl/endpoints_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
5050
args: args{
5151
[]string{"admin:ServerInfo"},
5252
},
53-
want: 2,
53+
want: 4,
5454
},
5555
{
5656
name: "policies endpoint",
@@ -63,7 +63,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
6363
"admin:ListUserPolicies",
6464
},
6565
},
66-
want: 2,
66+
want: 4,
6767
},
6868
{
6969
name: "all admin endpoints",
@@ -72,7 +72,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
7272
"admin:*",
7373
},
7474
},
75-
want: 13,
75+
want: 15,
7676
},
7777
{
7878
name: "all s3 endpoints",
@@ -81,7 +81,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
8181
"s3:*",
8282
},
8383
},
84-
want: 4,
84+
want: 6,
8585
},
8686
{
8787
name: "all admin and s3 endpoints",
@@ -91,7 +91,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
9191
"s3:*",
9292
},
9393
},
94-
want: 16,
94+
want: 18,
9595
},
9696
{
9797
name: "no endpoints",

portal-ui/src/screens/Console/Console.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ import Permissions from "./Permissions/Permissions";
5151
import Dashboard from "./Dashboard/Dashboard";
5252
import Menu from "./Menu/Menu";
5353
import api from "../../common/api";
54-
import storage from "local-storage-fallback";
55-
import NotFoundPage from "../NotFoundPage";
5654
import ServiceAccounts from "./ServiceAccounts/ServiceAccounts";
5755
import Users from "./Users/Users";
5856
import Groups from "./Groups/Groups";
@@ -70,6 +68,7 @@ import { saveSessionResponse } from "./actions";
7068
import TenantDetails from "./Tenants/TenantDetails/TenantDetails";
7169
import { clearSession } from "../../common/utils";
7270
import RemoteBuckets from "./RemoteBuckets/RemoteBuckets";
71+
import ObjectBrowser from "./ObjectBrowser/ObjectBrowser";
7372

7473
function Copyright() {
7574
return (
@@ -254,6 +253,14 @@ const Console = ({
254253
component: Buckets,
255254
path: "/buckets/:bucketName",
256255
},
256+
{
257+
component: ObjectBrowser,
258+
path: "/object-browser/:bucket?/*",
259+
},
260+
{
261+
component: ObjectBrowser,
262+
path: "/object-browser",
263+
},
257264
{
258265
component: Watch,
259266
path: "/watch",

portal-ui/src/screens/Console/Menu/Menu.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import ListItemIcon from "@material-ui/core/ListItemIcon";
2222
import WebAssetIcon from "@material-ui/icons/WebAsset";
2323
import HealingIcon from "@material-ui/icons/Healing";
2424
import CloudUploadIcon from "@material-ui/icons/CloudUpload";
25+
import DescriptionIcon from "@material-ui/icons/Description";
2526
import FileCopyIcon from "@material-ui/icons/FileCopy";
2627
import Collapse from "@material-ui/core/Collapse";
2728
import ListItemText from "@material-ui/core/ListItemText";
@@ -187,17 +188,17 @@ const Menu = ({ userLoggedIn, classes, pages }: IMenuProps) => {
187188
group: "User",
188189
type: "item",
189190
component: NavLink,
190-
to: "/buckets",
191-
name: "Buckets",
192-
icon: <BucketsIcon />,
191+
to: "/service-accounts",
192+
name: "Service Accounts",
193+
icon: <ServiceAccountsIcon />,
193194
},
194195
{
195196
group: "User",
196197
type: "item",
197198
component: NavLink,
198-
to: "/service-accounts",
199-
name: "Service Accounts",
200-
icon: <ServiceAccountsIcon />,
199+
to: "/object-browser",
200+
name: "Object Browser",
201+
icon: <DescriptionIcon />,
201202
},
202203
{
203204
group: "Admin",
@@ -215,6 +216,14 @@ const Menu = ({ userLoggedIn, classes, pages }: IMenuProps) => {
215216
name: "Groups",
216217
icon: <GroupsIcon />,
217218
},
219+
{
220+
group: "Admin",
221+
type: "item",
222+
component: NavLink,
223+
to: "/buckets",
224+
name: "Buckets",
225+
icon: <BucketsIcon />,
226+
},
218227
{
219228
group: "Admin",
220229
type: "item",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react";
2+
3+
const ObjectBrowser = (props: any) => {
4+
console.log(props);
5+
6+
return <React.Fragment>Object Browser</React.Fragment>;
7+
};
8+
9+
export default ObjectBrowser;

0 commit comments

Comments
 (0)