REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.50 KB
Close
/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/feature_management/control.py
Text
Base64
import functools import logging from packaging.version import Version from defence360agent.feature_management.constants import ( EXTENSION_DEFAULTS, FEATURE_EXT_VARIABLES, NATIVE_EXTENSION_NAME, NATIVE_FEATURE_MANAGEMENT_PACKAGE_EXTENSION_FILES, ) from defence360agent.feature_management.utils import reset_features from defence360agent.subsys.panels.cpanel import cPanel from defence360agent.subsys.panels.hosting_panel import HostingPanel logger = logging.getLogger(__name__) def supported(func): """Do not run a function on an unsupported panel""" @functools.wraps(func) async def wrapper(*args, **kwargs): if await is_native_feature_management_supported(): return await func(*args, **kwargs) logger.info("Native feature management is not supported") return wrapper async def is_native_feature_management_supported(): """Whether we support native feature management on the panel.""" hp = HostingPanel() if hp.NAME == cPanel.NAME: try: return Version(await hp.version()) >= Version("68.0") except ValueError: return False return False @supported async def is_native_feature_management_enabled(): """Whether the native feature management is enabled.""" hp = HostingPanel() return ( hp.is_extension_installed( pkgs=NATIVE_FEATURE_MANAGEMENT_PACKAGE_EXTENSION_FILES ) and await hp.is_hook_installed() ) @supported async def enable_native_feature_management(): """Enable native feature management.""" hp = HostingPanel() # reset feature values for all existing users await reset_features( **{ feature: EXTENSION_DEFAULTS[pe_var] for feature, pe_var in FEATURE_EXT_VARIABLES.items() } ) await hp.install_extension( NATIVE_EXTENSION_NAME, NATIVE_FEATURE_MANAGEMENT_PACKAGE_EXTENSION_FILES, **EXTENSION_DEFAULTS, ) logger.info("Imunify360 native feature management enabled.") @supported async def disable_native_feature_management(): """Disable native feature management.""" if not await is_native_feature_management_enabled(): logger.info("No Imunify360 package extensions to disable.") return True await HostingPanel().uninstall_extension( NATIVE_EXTENSION_NAME, NATIVE_FEATURE_MANAGEMENT_PACKAGE_EXTENSION_FILES, ) logger.info("Imunify360 native feature management disabled.") return True # disabled successfully
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 3 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
plugins
DIR
-
drwxr-xr-x
2026-06-08 20:24:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rpc
DIR
-
drwxr-xr-x
2026-06-08 20:24:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__pycache__
DIR
-
drwxr-xr-x
2026-06-08 20:24:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
checkers.py
2.45 KB
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
constants.py
1.05 KB
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
control.py
2.50 KB
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
exceptions.py
306 B
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
hooks.py
2.64 KB
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
lookup.py
2.76 KB
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
model.py
2.37 KB
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
utils.py
3.48 KB
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
0 B
lrw-r--r--
2026-05-26 21:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).