-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rate limiter failing /manage page test
Poor implementation makes /manage/groups page request /v1/permissions n times, where n is amount of groups. Since each visibility test registers a new group, there are a lot of them when opening the manage page, leading to tripping the rate-limiter
- Loading branch information
Showing
6 changed files
with
62 additions
and
20 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
43 changes: 43 additions & 0 deletions
43
...om/djrapitops/plan/storage/database/transactions/commands/RemoveWebGroupsTransaction.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,43 @@ | ||
/* | ||
* 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.commands; | ||
|
||
import com.djrapitops.plan.storage.database.sql.tables.webuser.SecurityTable; | ||
import com.djrapitops.plan.storage.database.sql.tables.webuser.WebGroupTable; | ||
import com.djrapitops.plan.storage.database.sql.tables.webuser.WebGroupToPermissionTable; | ||
import com.djrapitops.plan.storage.database.sql.tables.webuser.WebUserPreferencesTable; | ||
import com.djrapitops.plan.storage.database.transactions.Transaction; | ||
|
||
/** | ||
* Transaction that removes all web groups from the database. | ||
* | ||
* @author AuroraLS3 | ||
*/ | ||
public class RemoveWebGroupsTransaction extends Transaction { | ||
|
||
@Override | ||
protected void performOperations() { | ||
clearTable(WebUserPreferencesTable.TABLE_NAME); | ||
clearTable(SecurityTable.TABLE_NAME); | ||
clearTable(WebGroupToPermissionTable.TABLE_NAME); | ||
clearTable(WebGroupTable.TABLE_NAME); | ||
} | ||
|
||
private void clearTable(String tableName) { | ||
execute("DELETE FROM " + tableName); | ||
} | ||
} |
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