diff --git a/apps/applications/migrations/0018_auto_20220223_1642.py b/apps/applications/migrations/0018_auto_20220223_1642.py new file mode 100644 index 000000000..5f3af1455 --- /dev/null +++ b/apps/applications/migrations/0018_auto_20220223_1642.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.14 on 2022-02-23 08:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('applications', '0017_auto_20220217_2135'), + ] + + operations = [ + migrations.AlterField( + model_name='application', + name='type', + field=models.CharField(choices=[('mysql', 'MySQL'), ('oracle', 'Oracle'), ('postgresql', 'PostgreSQL'), ('mariadb', 'MariaDB'), ('sqlserver', 'SQLServer'), ('redis', 'Redis'), ('mongodb', 'MongoDB'), ('chrome', 'Chrome'), ('mysql_workbench', 'MySQL Workbench'), ('vmware_client', 'vSphere Client'), ('custom', 'Custom'), ('k8s', 'Kubernetes')], max_length=16, verbose_name='Type'), + ), + ] diff --git a/apps/assets/migrations/0087_auto_20220223_1642.py b/apps/assets/migrations/0087_auto_20220223_1642.py new file mode 100644 index 000000000..c2a1b020f --- /dev/null +++ b/apps/assets/migrations/0087_auto_20220223_1642.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.14 on 2022-02-23 08:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('assets', '0086_auto_20220217_2135'), + ] + + operations = [ + migrations.AlterField( + model_name='systemuser', + name='protocol', + field=models.CharField(choices=[('ssh', 'SSH'), ('rdp', 'RDP'), ('telnet', 'Telnet'), ('vnc', 'VNC'), ('mysql', 'MySQL'), ('oracle', 'Oracle'), ('mariadb', 'MariaDB'), ('postgresql', 'PostgreSQL'), ('sqlserver', 'SQLServer'), ('redis', 'Redis'), ('mongodb', 'MongoDB'), ('k8s', 'K8S')], default='ssh', max_length=16, verbose_name='Protocol'), + ), + ] diff --git a/apps/common/migrations/0007_permission.py b/apps/common/migrations/0007_permission.py new file mode 100644 index 000000000..8794b7c5b --- /dev/null +++ b/apps/common/migrations/0007_permission.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.14 on 2022-02-23 08:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('common', '0006_auto_20190304_1515'), + ] + + operations = [ + migrations.CreateModel( + name='Permission', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ], + options={ + 'permissions': [('view_resourcestatistics', 'Can view resource statistics')], + }, + ), + ] diff --git a/apps/common/models.py b/apps/common/models.py new file mode 100644 index 000000000..e716113cd --- /dev/null +++ b/apps/common/models.py @@ -0,0 +1,9 @@ +from django.db import models +from django.utils.translation import gettext_lazy as _ + + +class Permission(models.Model): + class Meta: + permissions = [ + ('view_resourcestatistics', _('Can view resource statistics')) + ] diff --git a/apps/jumpserver/api.py b/apps/jumpserver/api.py index 8edc35e76..d69d27c68 100644 --- a/apps/jumpserver/api.py +++ b/apps/jumpserver/api.py @@ -214,7 +214,7 @@ class DatesLoginMetricMixin: class IndexApi(DatesLoginMetricMixin, APIView): http_method_names = ['get'] rbac_perms = { - 'GET': 'view_auditview' + 'GET': 'common.view_resourcestatistics' } def get(self, request, *args, **kwargs): diff --git a/apps/perms/migrations/0025_auto_20220223_1642.py b/apps/perms/migrations/0025_auto_20220223_1642.py new file mode 100644 index 000000000..120039e40 --- /dev/null +++ b/apps/perms/migrations/0025_auto_20220223_1642.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.14 on 2022-02-23 08:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('perms', '0024_auto_20220217_2135'), + ] + + operations = [ + migrations.AlterField( + model_name='applicationpermission', + name='type', + field=models.CharField(choices=[('mysql', 'MySQL'), ('oracle', 'Oracle'), ('postgresql', 'PostgreSQL'), ('mariadb', 'MariaDB'), ('sqlserver', 'SQLServer'), ('redis', 'Redis'), ('mongodb', 'MongoDB'), ('chrome', 'Chrome'), ('mysql_workbench', 'MySQL Workbench'), ('vmware_client', 'vSphere Client'), ('custom', 'Custom'), ('k8s', 'Kubernetes')], max_length=16, verbose_name='Type'), + ), + ] diff --git a/apps/rbac/builtin.py b/apps/rbac/builtin.py index 71f7d0bc4..6d8d2490f 100644 --- a/apps/rbac/builtin.py +++ b/apps/rbac/builtin.py @@ -4,6 +4,7 @@ from .const import Scope, system_exclude_permissions, org_exclude_permissions auditor_perms = ( + ('common', 'permission', 'view', 'resourcestatistics'), ('audits', '*', '*', '*'), ('rbac', 'menupermission', 'view', 'auditview'), ('terminal', 'session', '*', '*'), diff --git a/apps/terminal/migrations/0044_auto_20220223_1642.py b/apps/terminal/migrations/0044_auto_20220223_1642.py new file mode 100644 index 000000000..463312f8e --- /dev/null +++ b/apps/terminal/migrations/0044_auto_20220223_1642.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.14 on 2022-02-23 08:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('terminal', '0043_auto_20220217_2135'), + ] + + operations = [ + migrations.AlterField( + model_name='session', + name='protocol', + field=models.CharField(choices=[('ssh', 'ssh'), ('rdp', 'rdp'), ('vnc', 'vnc'), ('telnet', 'telnet'), ('mysql', 'mysql'), ('oracle', 'oracle'), ('mariadb', 'mariadb'), ('sqlserver', 'sqlserver'), ('postgresql', 'postgresql'), ('redis', 'redis'), ('mongodb', 'MongoDB'), ('k8s', 'kubernetes')], db_index=True, default='ssh', max_length=16), + ), + ]