Skip to content

Commit

Permalink
fix: add settings for license version and facelive
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiJiangJie committed Dec 19, 2024
1 parent d17ca4f commit 3a7ae01
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions apps/acls/serializers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def set_action_choices(self):
return
if not settings.XPACK_LICENSE_IS_VALID:
field_action._choices.pop(ActionChoices.review, None)
if not (
settings.XPACK_LICENSE_IS_VALID and
settings.XPACK_LICENSE_EDITION_ULTIMATE and
settings.FACE_RECOGNITION_ENABLED
):
field_action._choices.pop(ActionChoices.face_verify, None)
field_action._choices.pop(ActionChoices.face_online, None)
for choice in self.Meta.action_choices_exclude:
field_action._choices.pop(choice, None)

Expand Down
9 changes: 5 additions & 4 deletions apps/authentication/mfa/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ def is_active(self):

@staticmethod
def global_enabled():
return settings.XPACK_LICENSE_IS_VALID \
and LicenseEditionChoices.ULTIMATE == \
LicenseEditionChoices.from_key(settings.XPACK_LICENSE_EDITION) \
and settings.FACE_RECOGNITION_ENABLED
return (
settings.XPACK_LICENSE_IS_VALID and
settings.XPACK_LICENSE_EDITION_ULTIMATE and
settings.FACE_RECOGNITION_ENABLED
)

def get_enable_url(self) -> str:
return '/ui/#/profile/index'
Expand Down
1 change: 1 addition & 0 deletions apps/jumpserver/settings/_xpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
XPACK_CONTEXT_PROCESSOR = []
XPACK_LICENSE_IS_VALID = False
XPACK_LICENSE_EDITION = ""
XPACK_LICENSE_EDITION_ULTIMATE = False
XPACK_LICENSE_INFO = {
'corporation': corporation,
}
Expand Down
2 changes: 2 additions & 0 deletions apps/settings/serializers/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class PrivateSettingSerializer(PublicSettingSerializer):
PASSWORD_RULE = serializers.DictField()
SECURITY_SESSION_SHARE = serializers.BooleanField()
XPACK_LICENSE_IS_VALID = serializers.BooleanField()
XPACK_LICENSE_EDITION_ULTIMATE = serializers.BooleanField()
FACE_RECOGNITION_ENABLED = serializers.BooleanField()
XPACK_LICENSE_INFO = serializers.DictField()
HELP_DOCUMENT_URL = serializers.CharField()
HELP_SUPPORT_URL = serializers.CharField()
Expand Down

0 comments on commit 3a7ae01

Please sign in to comment.