Skip to content

Commit

Permalink
Output name, but dont mark as writable attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Mar 22, 2021
1 parent b1b9591 commit c3edd40
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/contracts/users/base_contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 0 additions & 1 deletion lib/api/v3/principals/principal_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions lib/api/v3/users/schemas/user_schema_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 0 additions & 3 deletions spec/requests/api/v3/user/create_form_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
expect(body)
.to be_json_eql(''.to_json)
.at_path('_embedded/payload/login')
expect(body)
.to be_json_eql(' '.to_json)
.at_path('_embedded/payload/name')
expect(body)
.to be_json_eql(''.to_json)
.at_path('_embedded/payload/email')
Expand Down

0 comments on commit c3edd40

Please sign in to comment.