Browse Source

perf: support only su or sudo

pull/13914/head
Eric 4 months ago committed by Bryan
parent
commit
0c73acd4b9
  1. 2
      apps/assets/const/host.py
  2. 4
      apps/assets/serializers/platform.py

2
apps/assets/const/host.py

@ -19,7 +19,7 @@ class HostTypes(BaseType):
'charset': 'utf-8', # default 'charset': 'utf-8', # default
'domain_enabled': True, 'domain_enabled': True,
'su_enabled': True, 'su_enabled': True,
'su_methods': ['sudo', 'su'], 'su_methods': ['sudo', 'su', 'only_sudo', 'only_su'],
}, },
cls.WINDOWS: { cls.WINDOWS: {
'su_enabled': False, 'su_enabled': False,

4
apps/assets/serializers/platform.py

@ -1,4 +1,4 @@
from django.db.models import QuerySet, Count from django.db.models import QuerySet
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from rest_framework import serializers from rest_framework import serializers
from rest_framework.validators import UniqueValidator from rest_framework.validators import UniqueValidator
@ -162,6 +162,8 @@ class PlatformSerializer(ResourceLabelsMixin, WritableNestedModelSerializer):
SU_METHOD_CHOICES = [ SU_METHOD_CHOICES = [
("sudo", "sudo su -"), ("sudo", "sudo su -"),
("su", "su - "), ("su", "su - "),
("only_sudo", "sudo su"),
("only_su", "su"),
("enable", "enable"), ("enable", "enable"),
("super", "super 15"), ("super", "super 15"),
("super_level", "super level 15") ("super_level", "super level 15")

Loading…
Cancel
Save