From 8ecca64936b37f6cdd22197f50162a8faca73964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 17 Mar 2021 22:26:02 +0100 Subject: [PATCH] Output name, but dont mark as writable attribute --- app/contracts/users/base_contract.rb | 1 - lib/api/v3/principals/principal_representer.rb | 1 - lib/api/v3/users/schemas/user_schema_representer.rb | 5 +++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/contracts/users/base_contract.rb b/app/contracts/users/base_contract.rb index d066cbd5b94b..75cdd2801dd4 100644 --- a/app/contracts/users/base_contract.rb +++ b/app/contracts/users/base_contract.rb @@ -36,7 +36,6 @@ class BaseContract < ::ModelContract writeable: ->(*) { user.allowed_to_globally?(:manage_user) && model.id != user.id } attribute :firstname attribute :lastname - attribute :name attribute :mail attribute :admin, writeable: ->(*) { user.admin? && model.id != user.id } diff --git a/lib/api/v3/principals/principal_representer.rb b/lib/api/v3/principals/principal_representer.rb index 562c4df870b0..7801107fa995 100644 --- a/lib/api/v3/principals/principal_representer.rb +++ b/lib/api/v3/principals/principal_representer.rb @@ -62,7 +62,6 @@ class PrincipalRepresenter < ::API::Decorators::Single render_nil: true property :name, - skip_render: ->(*) { is_a?(User) }, render_nil: true date_time_property :created_at, diff --git a/lib/api/v3/users/schemas/user_schema_representer.rb b/lib/api/v3/users/schemas/user_schema_representer.rb index c57794b727f5..623dea4b2854 100644 --- a/lib/api/v3/users/schemas/user_schema_representer.rb +++ b/lib/api/v3/users/schemas/user_schema_representer.rb @@ -53,6 +53,11 @@ class UserSchemaRepresenter < ::API::Decorators::SchemaRepresenter min_length: 1, max_length: 255 + schema :name, + type: 'String', + required: false, + writable: false + schema :firstname, as: :firstName, type: 'String',