mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-06 01:40:52 +00:00
授权导入优化 (#6057)
* 授权导入优化,支持使用 用户名,资产名,ip,节点路径,系统用户名称导入 * Update permission.py * 授权导入优化 * 授权导入优化 * 授权导入优化 * 授权导入优化 Co-authored-by: fghbng@qq.com <fghbng@qq.com>
This commit is contained in:
@@ -72,7 +72,7 @@ class Action:
|
||||
def value_to_choices_display(cls, value):
|
||||
choices = cls.value_to_choices(value)
|
||||
return [str(dict(cls.choices())[i]) for i in choices]
|
||||
|
||||
|
||||
@classmethod
|
||||
def choices_to_value(cls, value):
|
||||
if not isinstance(value, list):
|
||||
@@ -143,6 +143,26 @@ class AssetPermission(BasePermission):
|
||||
assets = Asset.objects.filter(id__in=asset_ids)
|
||||
return assets
|
||||
|
||||
def users_display(self):
|
||||
names = [user.username for user in self.users.all()]
|
||||
return names
|
||||
|
||||
def user_groups_display(self):
|
||||
names = [group.name for group in self.user_groups.all()]
|
||||
return names
|
||||
|
||||
def assets_display(self):
|
||||
names = [asset.hostname for asset in self.assets.all()]
|
||||
return names
|
||||
|
||||
def system_users_display(self):
|
||||
names = [system_user.name for system_user in self.system_users.all()]
|
||||
return names
|
||||
|
||||
def nodes_display(self):
|
||||
names = [node.full_value for node in self.nodes.all()]
|
||||
return names
|
||||
|
||||
|
||||
class UserAssetGrantedTreeNodeRelation(OrgModelMixin, FamilyMixin, models.JMSBaseModel):
|
||||
class NodeFrom(ChoiceSet):
|
||||
|
Reference in New Issue
Block a user