Skip to content

Commit

Permalink
Implement License page (#324)
Browse files Browse the repository at this point in the history
* Implement License page

Fixes #320

* License Assets

* Fix endpoint tests

Co-authored-by: Daniel Valdivia <hola@danielvaldivia.com>
  • Loading branch information
kaankabalak and dvaldivia committed Oct 12, 2020
1 parent 6501a4b commit 1caa3f2
Show file tree
Hide file tree
Showing 9 changed files with 651 additions and 104 deletions.
8 changes: 8 additions & 0 deletions pkg/acl/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var (
replication = "/replication"
objectBrowser = "/object-browser/:bucket?"
mainObjectBrowser = "/object-browser"
license = "/license"
)

type ConfigurationActionSet struct {
Expand Down Expand Up @@ -236,6 +237,12 @@ var objectBrowserActionSet = ConfigurationActionSet{
actions: iampolicy.NewActionSet(),
}

// licenseActionSet no actions needed for this module to work
var licenseActionSet = ConfigurationActionSet{
actionTypes: iampolicy.NewActionSet(),
actions: iampolicy.NewActionSet(),
}

// endpointRules contains the mapping between endpoints and ActionSets, additional rules can be added here
var endpointRules = map[string]ConfigurationActionSet{
configuration: configurationActionSet,
Expand All @@ -256,6 +263,7 @@ var endpointRules = map[string]ConfigurationActionSet{
replication: replicationActionSet,
objectBrowser: objectBrowserActionSet,
mainObjectBrowser: objectBrowserActionSet,
license: licenseActionSet,
}

// operatorRules contains the mapping between endpoints and ActionSets for operator only mode
Expand Down
10 changes: 5 additions & 5 deletions pkg/acl/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
args: args{
[]string{"admin:ServerInfo"},
},
want: 4,
want: 5,
},
{
name: "policies endpoint",
Expand All @@ -63,7 +63,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"admin:ListUserPolicies",
},
},
want: 4,
want: 5,
},
{
name: "all admin endpoints",
Expand All @@ -72,7 +72,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"admin:*",
},
},
want: 15,
want: 16,
},
{
name: "all s3 endpoints",
Expand All @@ -81,7 +81,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"s3:*",
},
},
want: 6,
want: 7,
},
{
name: "all admin and s3 endpoints",
Expand All @@ -91,7 +91,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
"s3:*",
},
},
want: 18,
want: 19,
},
{
name: "no endpoints",
Expand Down
221 changes: 122 additions & 99 deletions portal-ui/bindata_assetfs.go

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions portal-ui/src/icons/LicenseIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// This file is part of MinIO Console Server
// Copyright (c) 2020 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import React from "react";
import { SvgIcon } from "@material-ui/core";

class LicenseIcon extends React.Component {
render() {
return (
<SvgIcon>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 11">
<path fill="#fff" d="M11 11H0V2h11v9zM2 8v1h7V8zm0-3v1h5V5z"></path>
<g
fill="#07274a"
stroke="#fdfdfd"
strokeWidth="0.5"
transform="translate(7)"
>
<circle cx="3" cy="3" r="3" stroke="none"></circle>
<circle cx="3" cy="3" r="2.75" fill="none"></circle>
</g>
<path
fill="none"
stroke="#fff"
strokeWidth="0.5"
d="M8.73 2.794l.954.953 1.471-1.471"
></path>
</svg>
</SvgIcon>
);
}
}

export default LicenseIcon;
5 changes: 5 additions & 0 deletions portal-ui/src/screens/Console/Console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import TenantDetails from "./Tenants/TenantDetails/TenantDetails";
import { clearSession } from "../../common/utils";
import ObjectBrowser from "./ObjectBrowser/ObjectBrowser";
import ListObjects from "./Buckets/ListBuckets/Objects/ListObjects/ListObjects";
import License from "./License/License";

function Copyright() {
return (
Expand Down Expand Up @@ -322,6 +323,10 @@ const Console = ({
component: TenantDetails,
path: "/namespaces/:tenantNamespace/tenants/:tenantName",
},
{
component: License,
path: "/license",
},
];
const allowedRoutes = routes.filter((route: any) => allowedPages[route.path]);

Expand Down

0 comments on commit 1caa3f2

Please sign in to comment.