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 17, 2021
1 parent b1b9591 commit 8ecca64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 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

0 comments on commit 8ecca64

Please sign in to comment.