jumpserver/apps/perms/const.py

33 lines
742 B
Python
Raw Normal View History

2021-08-31 06:13:05 +00:00
# -*- coding: utf-8 -*-
#
2022-11-11 07:04:31 +00:00
from django.db import models
from django.utils.translation import ugettext_lazy as _
from common.db.fields import BitChoices
2022-11-11 09:28:13 +00:00
from common.utils.integer import bit
2022-11-11 07:04:31 +00:00
2022-11-11 09:28:13 +00:00
__all__ = ["SpecialAccount", "ActionChoices"]
2022-11-11 07:04:31 +00:00
class ActionChoices(BitChoices):
2022-11-11 09:28:13 +00:00
connect = bit(0), _("Connect")
upload = bit(1), _("Upload")
download = bit(2), _("Download")
copy = bit(3), _("Copy")
paste = bit(4), _("Paste")
@classmethod
def is_tree(cls):
return True
2022-11-11 07:04:31 +00:00
@classmethod
def branches(cls):
return (
2022-11-11 09:28:13 +00:00
(_("Transfer"), [cls.upload, cls.download]),
(_("Clipboard"), [cls.copy, cls.paste]),
2022-11-11 07:04:31 +00:00
)
class SpecialAccount(models.TextChoices):
2022-11-11 09:28:13 +00:00
ALL = "@ALL", "All"