mirror of
https://git.isptech.ru/ISPsystem/isp-maintenance.git
synced 2025-10-30 07:03:02 +01:00
Update: dockerize app, rename pkg to mgrctl, fix imports
This commit is contained in:
15
mgrctl/apps/__init__.py
Normal file
15
mgrctl/apps/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# █▀▄▀█ █▀▀ ▀█▀ ▄▀█ ▀
|
||||
# █░▀░█ ██▄ ░█░ █▀█ ▄
|
||||
# -- -- -- -- -- -- -
|
||||
__author__ = "MOIS3Y, a.garaev, Failak3, Ann_M"
|
||||
__credits__ = [
|
||||
"Stepan Zhukovsky",
|
||||
"Arthur Garaev",
|
||||
"Vladislav Shmidt",
|
||||
"Anna Moskovkina"
|
||||
]
|
||||
__license__ = "MIT"
|
||||
__version__ = "0.1.0"
|
||||
__maintainer__ = "Stepan Zhukovsky"
|
||||
__email__ = "stepan@zhukovsky.me"
|
||||
__status__ = "Development"
|
||||
15
mgrctl/apps/dci6/__init__.py
Normal file
15
mgrctl/apps/dci6/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# █▀▄▀█ █▀▀ ▀█▀ ▄▀█ ▀
|
||||
# █░▀░█ ██▄ ░█░ █▀█ ▄
|
||||
# -- -- -- -- -- -- -
|
||||
__author__ = "MOIS3Y, a.garaev, Failak3, Ann_M"
|
||||
__credits__ = [
|
||||
"Stepan Zhukovsky",
|
||||
"Arthur Garaev",
|
||||
"Vladislav Shmidt",
|
||||
"Anna Moskovkina"
|
||||
]
|
||||
__license__ = "MIT"
|
||||
__version__ = "0.1.0"
|
||||
__maintainer__ = "Stepan Zhukovsky"
|
||||
__email__ = "stepan@zhukovsky.me"
|
||||
__status__ = "Development"
|
||||
0
mgrctl/apps/dci6/auth/__init__.py
Normal file
0
mgrctl/apps/dci6/auth/__init__.py
Normal file
12
mgrctl/apps/dci6/auth/commands.py
Normal file
12
mgrctl/apps/dci6/auth/commands.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import click
|
||||
|
||||
|
||||
@click.group(help='access command for lazy example')
|
||||
@click.option('--debug/--no-debug', default=False)
|
||||
def cli(debug):
|
||||
click.echo(f"Debug mode is {'on' if debug else 'off'}")
|
||||
|
||||
|
||||
@cli.command()
|
||||
def enable():
|
||||
click.echo('Access granted')
|
||||
13
mgrctl/apps/dci6/commands.py
Normal file
13
mgrctl/apps/dci6/commands.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import click
|
||||
|
||||
from mgrctl.cli.lazy_group import LazyGroup
|
||||
from mgrctl.settings.general import INSTALLED_APPS
|
||||
|
||||
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
lazy_subcommands=INSTALLED_APPS['dci6'],
|
||||
help='dci6 command for lazy example',
|
||||
)
|
||||
def cli():
|
||||
pass
|
||||
15
mgrctl/apps/vm6/__init__.py
Normal file
15
mgrctl/apps/vm6/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# █▀▄▀█ █▀▀ ▀█▀ ▄▀█ ▀
|
||||
# █░▀░█ ██▄ ░█░ █▀█ ▄
|
||||
# -- -- -- -- -- -- -
|
||||
__author__ = "MOIS3Y, a.garaev, Failak3, Ann_M"
|
||||
__credits__ = [
|
||||
"Stepan Zhukovsky",
|
||||
"Arthur Garaev",
|
||||
"Vladislav Shmidt",
|
||||
"Anna Moskovkina"
|
||||
]
|
||||
__license__ = "MIT"
|
||||
__version__ = "0.1.0"
|
||||
__maintainer__ = "Stepan Zhukovsky"
|
||||
__email__ = "stepan@zhukovsky.me"
|
||||
__status__ = "Development"
|
||||
10
mgrctl/apps/vm6/auth/__init__.py
Normal file
10
mgrctl/apps/vm6/auth/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# █▀▄▀█ █▀▀ ▀█▀ ▄▀█ ▀
|
||||
# █░▀░█ ██▄ ░█░ █▀█ ▄
|
||||
# -- -- -- -- -- -- -
|
||||
__author__ = "MOIS3Y"
|
||||
__credits__ = ["Stepan Zhukovsky"]
|
||||
__license__ = "MIT"
|
||||
__version__ = "0.1.0"
|
||||
__maintainer__ = "Stepan Zhukovsky"
|
||||
__email__ = "stepan@zhukovsky.me"
|
||||
__status__ = "Development"
|
||||
31
mgrctl/apps/vm6/auth/commands.py
Normal file
31
mgrctl/apps/vm6/auth/commands.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import click
|
||||
|
||||
from mgrctl.db.vm6.databases import isp_database
|
||||
from mgrctl.db.vm6.models import AuthUser
|
||||
|
||||
from mgrctl.apps.vm6.auth import __version__
|
||||
|
||||
|
||||
@click.group(help='auth cmd for auth in VMmanager 6')
|
||||
@click.version_option(
|
||||
version=__version__,
|
||||
package_name='mgrctl.apps.vm6.auth',
|
||||
message=__version__
|
||||
)
|
||||
def cli():
|
||||
pass
|
||||
|
||||
|
||||
@cli.command(help='show all users and their roles on platform (DEMO EXAMPLE)')
|
||||
def users():
|
||||
# check and init connection to db:
|
||||
isp_database.connect()
|
||||
# get all fields from auth_user table
|
||||
# SELECT * FROM auth_user;
|
||||
all_users = AuthUser.select()
|
||||
# Iterate fields and print to console users' email and role
|
||||
for user in all_users:
|
||||
result = f'{user.email} | {user.roles[0]}'
|
||||
click.echo(result)
|
||||
# Close connection
|
||||
isp_database.close()
|
||||
19
mgrctl/apps/vm6/commands.py
Normal file
19
mgrctl/apps/vm6/commands.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import click
|
||||
|
||||
from mgrctl.cli.lazy_group import LazyGroup
|
||||
from mgrctl.settings.general import INSTALLED_APPS
|
||||
from mgrctl.apps.vm6 import __version__
|
||||
|
||||
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
lazy_subcommands=INSTALLED_APPS['vm6'],
|
||||
help='vm6 command for lazy example',
|
||||
)
|
||||
@click.version_option(
|
||||
version=__version__,
|
||||
package_name='mgrctl',
|
||||
message=__version__
|
||||
)
|
||||
def cli():
|
||||
pass
|
||||
Reference in New Issue
Block a user