mirror of https://github.com/jumpserver/jumpserver
Merge branch 'dev' of github.com:jumpserver/jumpserver into dev
commit
cc56c92562
|
@ -15,7 +15,7 @@ from .user import AdminUser, SystemUser
|
|||
from .utils import Connectivity
|
||||
from orgs.mixins import OrgModelMixin, OrgManager
|
||||
|
||||
__all__ = ['Asset']
|
||||
__all__ = ['Asset', 'ProtocolsMixin']
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ __all__ = [
|
|||
|
||||
|
||||
class Action:
|
||||
NONE = 0
|
||||
CONNECT = 0b00000001
|
||||
UPLOAD = 0b00000010
|
||||
DOWNLOAD = 0b00000100
|
||||
|
@ -51,13 +52,20 @@ class Action:
|
|||
|
||||
@classmethod
|
||||
def choices_to_value(cls, value):
|
||||
if not isinstance(value, list):
|
||||
return cls.NONE
|
||||
db_value = [
|
||||
cls.NAME_MAP_REVERSE[v] for v in value
|
||||
if v in cls.NAME_MAP_REVERSE.keys()
|
||||
]
|
||||
if not db_value:
|
||||
return cls.NONE
|
||||
|
||||
def to_choices(x, y):
|
||||
x = cls.NAME_MAP_REVERSE.get(x, 0)
|
||||
y = cls.NAME_MAP_REVERSE.get(y, 0)
|
||||
return x | y
|
||||
if not value:
|
||||
return None
|
||||
return reduce(to_choices, value)
|
||||
|
||||
result = reduce(to_choices, db_value)
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def choices(cls):
|
||||
|
|
Loading…
Reference in New Issue