-
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Re-register admin group on reload if missing - Don't assume group with name 'admin' exists - Add permissions for viewing network and server overview numbers separately - Night mode fixes - Help modal for group management
- Loading branch information
Showing
15 changed files
with
149 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...apitops/plan/storage/database/transactions/patches/WebGroupAddMissingAdminGroupPatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* This file is part of Player Analytics (Plan). | ||
* | ||
* Plan is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License v3 as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Plan 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 Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Plan. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.djrapitops.plan.storage.database.transactions.patches; | ||
|
||
import com.djrapitops.plan.delivery.domain.auth.WebPermission; | ||
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; | ||
import com.djrapitops.plan.storage.database.transactions.StoreWebGroupTransaction; | ||
|
||
import java.util.Arrays; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Adds admin group back to the database if user accidentally deletes it. | ||
* | ||
* @author AuroraLS3 | ||
*/ | ||
public class WebGroupAddMissingAdminGroupPatch extends Patch { | ||
|
||
@Override | ||
public boolean hasBeenApplied() { | ||
return !query(WebUserQueries.fetchGroupNamesWithPermission(WebPermission.MANAGE_GROUPS.getPermission())).isEmpty(); | ||
} | ||
|
||
@Override | ||
protected void applyPatch() { | ||
executeOther(new StoreWebGroupTransaction("admin", Arrays.stream(new WebPermission[]{ | ||
WebPermission.PAGE, | ||
WebPermission.ACCESS, | ||
WebPermission.MANAGE_GROUPS, | ||
WebPermission.MANAGE_USERS | ||
}) | ||
.map(WebPermission::getPermission) | ||
.collect(Collectors.toList())) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Plan/react/dashboard/src/components/modal/help/GroupPermissionHelp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; | ||
import {faExclamationTriangle} from "@fortawesome/free-solid-svg-icons"; | ||
import {useMetadata} from "../../../hooks/metadataHook"; | ||
|
||
const GroupPermissionHelp = () => { | ||
const {mainCommand} = useMetadata(); | ||
return ( | ||
<div className={"group-help"}> | ||
<p>This view allows you to modify web group permissions.</p> | ||
<p>User's web group is determined during <code>/{mainCommand} register</code> by | ||
checking if Player has <code>{"plan.webgroup.{group_name}"}</code> permission. First one that is found | ||
is used.</p> | ||
<p>You can use <code>/{mainCommand} setgroup {"{username} {group_name}"}</code> to change permission group | ||
after | ||
registering (Needs <code>plan.setgroup.other</code> permission).</p> | ||
<p><FontAwesomeIcon icon={faExclamationTriangle}/> If you ever accidentally delete all groups | ||
with <i>manage.groups</i> permission just <code>/{mainCommand} reload</code>.</p> | ||
<h3>Permission inheritance</h3> | ||
<p>Permissions follow inheritance model, where higher level permission grants all lower ones, | ||
eg. <i>page.network</i> also gives <i>page.network.overview</i>, etc.</p> | ||
<ul> | ||
<li> | ||
If given <i>page.network</i> the user can see everything on the network page. | ||
</li> | ||
<li> | ||
If given <i>page.network.overview.graphs.online</i>, the user can | ||
see just the Players Online Graph on Network Overview, | ||
even if they don't have <i>page.network.overview</i> permission. | ||
</li> | ||
</ul> | ||
<h3>Access vs Page -permissions</h3> | ||
<p>You need to assign both access and page permissions for users.</p> | ||
<ul> | ||
<li> | ||
<i>access</i> permissions allow user make the request to specific address, | ||
eg. <i>access.network</i> allows request to /network. | ||
</li> | ||
<li> | ||
<i>page</i> permissions determine what parts of the page are visible, | ||
eg. <i>page.network.overview</i> allows viewing Network Overview. | ||
These permissions also limit requests to the related data, | ||
eg. <i>page.network.overview.numbers</i> allows request to /v1/network/overview. | ||
</li> | ||
<li> | ||
<i>access</i> permissions are not required for data: <i>page.network.overview.numbers</i> allows | ||
request to /v1/network/overview even without <i>access.network</i>. | ||
</li> | ||
</ul> | ||
<h3>Adding or deleting groups</h3> | ||
<p>Group names can be 100 characters long, and the Add group -form forces them to correct format. Only use | ||
characters supported by your permission system so that it can | ||
check <code>{"plan.webgroup.{group_name}"}</code> permission.</p> | ||
<p>When you delete a group you need to choose where users of that group are moved. There is no undo button, | ||
so choose carefully.</p> | ||
<h3>Saving changes</h3> | ||
<p>Group permissions are stored in the database.</p> | ||
<p>When you add a group or delete a group that action is saved right away.</p> | ||
<p>When you modify permissions those changes need to be saved by pressing the Save-button</p> | ||
</div> | ||
) | ||
}; | ||
|
||
export default GroupPermissionHelp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1474,3 +1474,7 @@ ul.filters { | |
width: 0 | ||
} | ||
} | ||
|
||
.group-help i { | ||
color: var(--color-plan) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters