-
-
Notifications
You must be signed in to change notification settings - Fork 178
Add optional reason to server/user moderation actions via API #1298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
Removed unnecessary comments and improved the search input handling. Updated links and adjusted layout for better readability.
Updated suspend method to accept a reason parameter from the request and log it.
Added reason parameter to unSuspend method for logging.
Updated constants to public visibility and added destroy method for user deletion.
|
I think we should set a character limit for the reason text; if a message is too long, it will break the layout on the Activity Log page. Is it worth making a restriction? And how many symbols exactly? |
Added validation for 'reason' input in destroy, suspend, and unSuspend methods.
Added validation for 'reason' input in suspend, unsuspend, and destroy methods.
Removed validation for 'reason' input in destroy, suspend, and unSuspend methods. Added substring limitation for 'reason' input.
Removed validation for 'reason' input and added substring limitation.
|
The reason field is now automatically truncated to 320 characters using mb_substr to ensure log compatibility and prevent potential database overflows 🤗 |
It seems to me that the approach with |
|
I considered that approach, but it turned out to be extremely inconvenient and impractical. I develop my own systems that automatically clean up stopped servers, block users attempting to bypass account restrictions, and so on, and it’s very convenient for me to pass detailed reason strings like:
Sometimes the length of the email or username fits within the 320-character limit, but other times the username or email is so long that if we return an error if the reason is more than the required number of characters, the block will fail. This creates a vulnerability where users could deliberately create long emails, usernames, server names, file names, etc. In my case, for example, this would constantly cause errors and the user/server would not be blocked. |
|
It's best to leave it as it was before, with |
The fact that your use case needs this should not affect the code of the original CtrlPanel. You can create your own fork that will have the fixes you need. It's not a good practice to push changes that your use case needs in the public project codebase. Maybe my explanation isn't perfect, because I'm writing this on the fly |
|
What I'm saying is that developers won't always add static reason text. I didn't try to describe my needs specifically, but gave an example of how I use it and how other developers can use it. This change does not change the panel code in any way, because the changes do not even make sending a reason mandatory |
|
That is, just make a direct return of the error?> It's best to leave it as it was before, with |
Use |
Done |
This pull request enhances the management functionality for both servers and users by introducing optional reason parameters for suspension, unsuspension, and deletion via the API. This allows administrators to provide context for these actions, which is then recorded in the activity log for improved auditability and tracking.
Changes Made:
API Usage:
Servers:
Users: