mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 13:41:28 -03:30
Hide script contents if the user is not a super user
This commit is contained in:
parent
9a44f8eca8
commit
9b61956c9e
@ -975,10 +975,18 @@ class GroupVariableDataSerializer(BaseVariableDataSerializer):
|
||||
|
||||
class CustomInventoryScriptSerializer(BaseSerializer):
|
||||
|
||||
script = serializers.SerializerMethodField('get_script')
|
||||
|
||||
class Meta:
|
||||
model = CustomInventoryScript
|
||||
fields = ('*', "script", "organization")
|
||||
|
||||
def get_script(self, obj):
|
||||
request = self.context.get('request', None)
|
||||
if request is not None and request.user is not None and request.user.is_superuser:
|
||||
return obj.script
|
||||
return None
|
||||
|
||||
class InventorySourceOptionsSerializer(BaseSerializer):
|
||||
|
||||
class Meta:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user