MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / admin_kick_user

Function admin_kick_user

Scripts/ButSystem.py:12218–12241  ·  view source on GitHub ↗

admin_kick_user. Admin-only route handler. This docstring was expanded to make future maintenance easier. Returns: Varies.

()

Source from the content-addressed store, hash-verified

12216 if any(ch in name for ch in ("/", "\\", "\x00", "\n", "\r")):
12217 raise ValueError("bad_name")
12218 return name
12219
12220
12221def _unique_destination(directory: str, filename: str) -> str:
12222 candidate = os.path.join(directory, filename)
12223 if not os.path.exists(candidate):
12224 return candidate
12225 p = pathlib.Path(filename)
12226 stem, suffix = p.stem or p.name, p.suffix
12227 idx = 2
12228 while True:
12229 candidate = os.path.join(directory, f"{stem} ({idx}){suffix}")
12230 if not os.path.exists(candidate):
12231 return candidate
12232 idx += 1
12233
12234
12235def _disk_allows_upload(target_dir: str, expected_total: int, already_written: int = 0) -> bool:
12236 try:
12237 usage = shutil.disk_usage(target_dir)
12238 remaining = max(0, int(expected_total) - max(0, int(already_written)))
12239 predicted = int(usage.used) + remaining
12240 return usage.total > 0 and (predicted / usage.total) < FILE_STORAGE_MAX_RATIO and usage.free >= remaining
12241 except Exception:
12242 return False
12243
12244

Callers

nothing calls this directly

Calls 4

require_adminFunction · 0.70
current_userFunction · 0.70
db_connectFunction · 0.70
now_zFunction · 0.70

Tested by

no test coverage detected