Skip to content

Commit 1caa3f2

Browse files
Implement License page (#324)
* Implement License page Fixes #320 * License Assets * Fix endpoint tests Co-authored-by: Daniel Valdivia <hola@danielvaldivia.com>
1 parent 6501a4b commit 1caa3f2

File tree

9 files changed

+651
-104
lines changed

9 files changed

+651
-104
lines changed

pkg/acl/endpoints.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var (
4242
replication = "/replication"
4343
objectBrowser = "/object-browser/:bucket?"
4444
mainObjectBrowser = "/object-browser"
45+
license = "/license"
4546
)
4647

4748
type ConfigurationActionSet struct {
@@ -236,6 +237,12 @@ var objectBrowserActionSet = ConfigurationActionSet{
236237
actions: iampolicy.NewActionSet(),
237238
}
238239

240+
// licenseActionSet no actions needed for this module to work
241+
var licenseActionSet = ConfigurationActionSet{
242+
actionTypes: iampolicy.NewActionSet(),
243+
actions: iampolicy.NewActionSet(),
244+
}
245+
239246
// endpointRules contains the mapping between endpoints and ActionSets, additional rules can be added here
240247
var endpointRules = map[string]ConfigurationActionSet{
241248
configuration: configurationActionSet,
@@ -256,6 +263,7 @@ var endpointRules = map[string]ConfigurationActionSet{
256263
replication: replicationActionSet,
257264
objectBrowser: objectBrowserActionSet,
258265
mainObjectBrowser: objectBrowserActionSet,
266+
license: licenseActionSet,
259267
}
260268

261269
// 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: 4,
53+
want: 5,
5454
},
5555
{
5656
name: "policies endpoint",
@@ -63,7 +63,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
6363
"admin:ListUserPolicies",
6464
},
6565
},
66-
want: 4,
66+
want: 5,
6767
},
6868
{
6969
name: "all admin endpoints",
@@ -72,7 +72,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
7272
"admin:*",
7373
},
7474
},
75-
want: 15,
75+
want: 16,
7676
},
7777
{
7878
name: "all s3 endpoints",
@@ -81,7 +81,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
8181
"s3:*",
8282
},
8383
},
84-
want: 6,
84+
want: 7,
8585
},
8686
{
8787
name: "all admin and s3 endpoints",
@@ -91,7 +91,7 @@ func TestGetAuthorizedEndpoints(t *testing.T) {
9191
"s3:*",
9292
},
9393
},
94-
want: 18,
94+
want: 19,
9595
},
9696
{
9797
name: "no endpoints",

portal-ui/bindata_assetfs.go

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

portal-ui/src/icons/LicenseIcon.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// This file is part of MinIO Console Server
2+
// Copyright (c) 2020 MinIO, Inc.
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Affero General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Affero General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Affero General Public License
15+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17+
import React from "react";
18+
import { SvgIcon } from "@material-ui/core";
19+
20+
class LicenseIcon extends React.Component {
21+
render() {
22+
return (
23+
<SvgIcon>
24+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 11">
25+
<path fill="#fff" d="M11 11H0V2h11v9zM2 8v1h7V8zm0-3v1h5V5z"></path>
26+
<g
27+
fill="#07274a"
28+
stroke="#fdfdfd"
29+
strokeWidth="0.5"
30+
transform="translate(7)"
31+
>
32+
<circle cx="3" cy="3" r="3" stroke="none"></circle>
33+
<circle cx="3" cy="3" r="2.75" fill="none"></circle>
34+
</g>
35+
<path
36+
fill="none"
37+
stroke="#fff"
38+
strokeWidth="0.5"
39+
d="M8.73 2.794l.954.953 1.471-1.471"
40+
></path>
41+
</svg>
42+
</SvgIcon>
43+
);
44+
}
45+
}
46+
47+
export default LicenseIcon;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import TenantDetails from "./Tenants/TenantDetails/TenantDetails";
6969
import { clearSession } from "../../common/utils";
7070
import ObjectBrowser from "./ObjectBrowser/ObjectBrowser";
7171
import ListObjects from "./Buckets/ListBuckets/Objects/ListObjects/ListObjects";
72+
import License from "./License/License";
7273

7374
function Copyright() {
7475
return (
@@ -322,6 +323,10 @@ const Console = ({
322323
component: TenantDetails,
323324
path: "/namespaces/:tenantNamespace/tenants/:tenantName",
324325
},
326+
{
327+
component: License,
328+
path: "/license",
329+
},
325330
];
326331
const allowedRoutes = routes.filter((route: any) => allowedPages[route.path]);
327332

0 commit comments

Comments
 (0)