# Add to serializer only for staff and current user

**URL:** https://meta.discourse.org/t/add-to-serializer-only-for-staff-and-current-user/155261
**Category:** Development
**Created:** [June 18, 2020, 6:50pm UTC](https://meta.discourse.org/t/add-to-serializer-only-for-staff-and-current-user/155261 "2020-06-18T18:50:21Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![paresy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paresy/32/96471_2.png) [@paresy](https://meta.discourse.org/u/paresy)
#### Post date: [February 13, 2021, 9:23pm UTC](https://meta.discourse.org/t/add-to-serializer-only-for-staff-and-current-user/155261/7 "2021-02-13T21:23:24Z")

</div>

This seem to be the droids i was looking for 🙂

```plaintext
  add_to_serializer(:post, :user_xxx, false) {
    #object.user.custom_fields['xxx'] if object.user && scope.is_admin?
    #object.user.custom_fields['xxx'] if object.user && scope.is_moderator?

    # Staff will allow for Admins and Moderators
    object.user.custom_fields['xxx'] if object.user && scope.is_staff?
  }

```

---

_[View the full topic](https://meta.discourse.org/t/add-to-serializer-only-for-staff-and-current-user/155261)._
