mirror of https://github.com/jumpserver/jumpserver
fix: 修复没有 push_now 权限的用户可以在创建资产、创建账号中开启推送
parent
c5b8ae6c9a
commit
4c96d6935a
|
@ -76,6 +76,12 @@ class AssetAccountSerializer(
|
|||
'secret': {'write_only': True},
|
||||
}
|
||||
|
||||
def validate_push_now(self, value):
|
||||
request = self.context['request']
|
||||
if not request.user.has_perms('assets.push_assetaccount'):
|
||||
return False
|
||||
return value
|
||||
|
||||
def validate_name(self, value):
|
||||
if not value:
|
||||
value = self.initial_data.get('username')
|
||||
|
|
Loading…
Reference in New Issue