from defence360agent.subsys.panels.base import PanelException from defence360agent.subsys.panels.directadmin import DirectAdmin from defence360agent.subsys.panels.hosting_panel import HostingPanel from defence360agent.rpc_tools import ValidationError from defence360agent.rpc_tools.lookup import RootEndpoints, bind class HostingPanelEndpoints(RootEndpoints): @bind("enable-plugin") async def enable_plugin(self, plugin_name=None): return await self.hosting_panel.enable_imunify360_plugin(plugin_name) @bind("disable-plugin") async def disable_plugin(self, plugin_name=None): return await self.hosting_panel.disable_imunify360_plugin(plugin_name) @bind("add-sudouser") async def add_sudouser(self, user): hp = self.hosting_panel if not isinstance(hp, DirectAdmin): raise ValidationError("Feature available only for DirectAdmin") return await hp.add_sudouser(user) @bind("delete-sudouser") async def delete_sudouser(self, user): hp = self.hosting_panel if not isinstance(hp, DirectAdmin): raise ValidationError("Feature available only for DirectAdmin") return await hp.delete_sudouser(user) @bind("list-docroots") async def get_docroots(self): return {"items": await self.hosting_panel.list_docroots()} @property def hosting_panel(self): try: return HostingPanel() except PanelException as e: raise ValidationError(str(e))
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
schema | Folder | 0755 |
|
|
schema_responses | Folder | 0755 |
|
|
__init__.py | File | 15.07 KB | 0644 |
|
advisor.py | File | 1.49 KB | 0644 |
|
endpoints.py | File | 10.6 KB | 0644 |
|
hooks.py | File | 2.82 KB | 0644 |
|
hosting_panel.py | File | 1.48 KB | 0644 |
|
myimunify.py | File | 2.77 KB | 0644 |
|
permissions.py | File | 311 B | 0644 |
|
plesk_stats.py | File | 4.33 KB | 0644 |
|
reputation_management.py | File | 1.95 KB | 0644 |
|
schema.py | File | 6.16 KB | 0644 |
|