Added object browser main paths (#302)

Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
Alex
2020-09-30 19:46:07 -05:00
committed by GitHub
parent 7afd608faa
commit 98f897ed5b
5 changed files with 82 additions and 47 deletions

View File

@@ -22,24 +22,26 @@ import (
// endpoints definition // endpoints definition
var ( var (
configuration = "/configurations-list" configuration = "/configurations-list"
users = "/users" users = "/users"
groups = "/groups" groups = "/groups"
iamPolicies = "/policies" iamPolicies = "/policies"
dashboard = "/dashboard" dashboard = "/dashboard"
profiling = "/profiling" profiling = "/profiling"
trace = "/trace" trace = "/trace"
logs = "/logs" logs = "/logs"
watch = "/watch" watch = "/watch"
notifications = "/notification-endpoints" notifications = "/notification-endpoints"
buckets = "/buckets" buckets = "/buckets"
bucketsDetail = "/buckets/:bucketName" bucketsDetail = "/buckets/:bucketName"
serviceAccounts = "/service-accounts" serviceAccounts = "/service-accounts"
tenants = "/tenants" tenants = "/tenants"
tenantsDetail = "/namespaces/:tenantNamespace/tenants/:tenantName" tenantsDetail = "/namespaces/:tenantNamespace/tenants/:tenantName"
heal = "/heal" heal = "/heal"
remoteBuckets = "/remote-buckets" remoteBuckets = "/remote-buckets"
replication = "/replication" replication = "/replication"
objectBrowser = "/object-browser/:bucket?/*"
mainObjectBrowser = "/object-browser"
) )
type ConfigurationActionSet struct { type ConfigurationActionSet struct {
@@ -228,24 +230,32 @@ var replicationActionSet = ConfigurationActionSet{
), ),
} }
// objectBrowserActionSet no actions needed for this module to work
var objectBrowserActionSet = ConfigurationActionSet{
actionTypes: iampolicy.NewActionSet(),
actions: iampolicy.NewActionSet(),
}
// endpointRules contains the mapping between endpoints and ActionSets, additional rules can be added here // endpointRules contains the mapping between endpoints and ActionSets, additional rules can be added here
var endpointRules = map[string]ConfigurationActionSet{ var endpointRules = map[string]ConfigurationActionSet{
configuration: configurationActionSet, configuration: configurationActionSet,
users: usersActionSet, users: usersActionSet,
groups: groupsActionSet, groups: groupsActionSet,
iamPolicies: iamPoliciesActionSet, iamPolicies: iamPoliciesActionSet,
dashboard: dashboardActionSet, dashboard: dashboardActionSet,
profiling: profilingActionSet, profiling: profilingActionSet,
trace: traceActionSet, trace: traceActionSet,
logs: logsActionSet, logs: logsActionSet,
watch: watchActionSet, watch: watchActionSet,
notifications: notificationsActionSet, notifications: notificationsActionSet,
buckets: bucketsActionSet, buckets: bucketsActionSet,
bucketsDetail: bucketsActionSet, bucketsDetail: bucketsActionSet,
serviceAccounts: serviceAccountsActionSet, serviceAccounts: serviceAccountsActionSet,
heal: healActionSet, heal: healActionSet,
remoteBuckets: remoteBucketsActionSet, remoteBuckets: remoteBucketsActionSet,
replication: replicationActionSet, replication: replicationActionSet,
objectBrowser: objectBrowserActionSet,
mainObjectBrowser: objectBrowserActionSet,
} }
// operatorRules contains the mapping between endpoints and ActionSets for operator only mode // operatorRules contains the mapping between endpoints and ActionSets for operator only mode

View File

@@ -50,7 +50,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
args: args{ args: args{
[]string{"admin:ServerInfo"}, []string{"admin:ServerInfo"},
}, },
want: 2, want: 4,
}, },
{ {
name: "policies endpoint", name: "policies endpoint",
@@ -63,7 +63,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"admin:ListUserPolicies", "admin:ListUserPolicies",
}, },
}, },
want: 2, want: 4,
}, },
{ {
name: "all admin endpoints", name: "all admin endpoints",
@@ -72,7 +72,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"admin:*", "admin:*",
}, },
}, },
want: 13, want: 15,
}, },
{ {
name: "all s3 endpoints", name: "all s3 endpoints",
@@ -81,7 +81,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"s3:*", "s3:*",
}, },
}, },
want: 4, want: 6,
}, },
{ {
name: "all admin and s3 endpoints", name: "all admin and s3 endpoints",
@@ -91,7 +91,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"s3:*", "s3:*",
}, },
}, },
want: 16, want: 18,
}, },
{ {
name: "no endpoints", name: "no endpoints",

View File

@@ -51,8 +51,6 @@ import Permissions from "./Permissions/Permissions";
import Dashboard from "./Dashboard/Dashboard"; import Dashboard from "./Dashboard/Dashboard";
import Menu from "./Menu/Menu"; import Menu from "./Menu/Menu";
import api from "../../common/api"; import api from "../../common/api";
import storage from "local-storage-fallback";
import NotFoundPage from "../NotFoundPage";
import ServiceAccounts from "./ServiceAccounts/ServiceAccounts"; import ServiceAccounts from "./ServiceAccounts/ServiceAccounts";
import Users from "./Users/Users"; import Users from "./Users/Users";
import Groups from "./Groups/Groups"; import Groups from "./Groups/Groups";
@@ -70,6 +68,7 @@ import { saveSessionResponse } from "./actions";
import TenantDetails from "./Tenants/TenantDetails/TenantDetails"; import TenantDetails from "./Tenants/TenantDetails/TenantDetails";
import { clearSession } from "../../common/utils"; import { clearSession } from "../../common/utils";
import RemoteBuckets from "./RemoteBuckets/RemoteBuckets"; import RemoteBuckets from "./RemoteBuckets/RemoteBuckets";
import ObjectBrowser from "./ObjectBrowser/ObjectBrowser";
function Copyright() { function Copyright() {
return ( return (
@@ -254,6 +253,14 @@ const Console = ({
component: Buckets, component: Buckets,
path: "/buckets/:bucketName", path: "/buckets/:bucketName",
}, },
{
component: ObjectBrowser,
path: "/object-browser/:bucket?/*",
},
{
component: ObjectBrowser,
path: "/object-browser",
},
{ {
component: Watch, component: Watch,
path: "/watch", path: "/watch",

View File

@@ -22,6 +22,7 @@ import ListItemIcon from "@material-ui/core/ListItemIcon";
import WebAssetIcon from "@material-ui/icons/WebAsset"; import WebAssetIcon from "@material-ui/icons/WebAsset";
import HealingIcon from "@material-ui/icons/Healing"; import HealingIcon from "@material-ui/icons/Healing";
import CloudUploadIcon from "@material-ui/icons/CloudUpload"; import CloudUploadIcon from "@material-ui/icons/CloudUpload";
import DescriptionIcon from "@material-ui/icons/Description";
import FileCopyIcon from "@material-ui/icons/FileCopy"; import FileCopyIcon from "@material-ui/icons/FileCopy";
import Collapse from "@material-ui/core/Collapse"; import Collapse from "@material-ui/core/Collapse";
import ListItemText from "@material-ui/core/ListItemText"; import ListItemText from "@material-ui/core/ListItemText";
@@ -187,17 +188,17 @@ const Menu = ({ userLoggedIn, classes, pages }: IMenuProps) => {
group: "User", group: "User",
type: "item", type: "item",
component: NavLink, component: NavLink,
to: "/buckets", to: "/service-accounts",
name: "Buckets", name: "Service Accounts",
icon: <BucketsIcon />, icon: <ServiceAccountsIcon />,
}, },
{ {
group: "User", group: "User",
type: "item", type: "item",
component: NavLink, component: NavLink,
to: "/service-accounts", to: "/object-browser",
name: "Service Accounts", name: "Object Browser",
icon: <ServiceAccountsIcon />, icon: <DescriptionIcon />,
}, },
{ {
group: "Admin", group: "Admin",
@@ -215,6 +216,14 @@ const Menu = ({ userLoggedIn, classes, pages }: IMenuProps) => {
name: "Groups", name: "Groups",
icon: <GroupsIcon />, icon: <GroupsIcon />,
}, },
{
group: "Admin",
type: "item",
component: NavLink,
to: "/buckets",
name: "Buckets",
icon: <BucketsIcon />,
},
{ {
group: "Admin", group: "Admin",
type: "item", type: "item",

View File

@@ -0,0 +1,9 @@
import React from "react";
const ObjectBrowser = (props: any) => {
console.log(props);
return <React.Fragment>Object Browser</React.Fragment>;
};
export default ObjectBrowser;