# 권한을 강제하는 가장 좋은 방법은 무엇인가요? 컨트롤러인지 제약 조건인지?

**URL:** <https://meta.discourse.org/t/best-way-to-enforce-permissions-controller-or-constraint/176113>\
**Category:** Development\
**Created:** [1월 14, 2021, 5:02오후 UTC](https://meta.discourse.org/t/best-way-to-enforce-permissions-controller-or-constraint/176113 "2021-01-14T17:02:56Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)\
**Post date:** [1월 18, 2021, 7:07오전 UTC](https://meta.discourse.org/t/best-way-to-enforce-permissions-controller-or-constraint/176113/4 "2021-01-18T07:07:23Z")

</div>

사용자가 특정 작업을 수행할 수 있는지 확인하기 위해 가디언(guardian) 메서드가 필요하다고 생각합니다. 예를 들어 `can_upgrade_server?` 같은 메서드요.

또한, 그렇게 한 후에는 `guardian.ensure_can_upgrade_server!` 메서드를 사용할 수 있습니다. 이 메서드는 조건을 확인하고 예외를 발생시키는데, 저는 이것이 정확히 원하시는 기능이라고 생각합니다.

---

_[View the full topic](https://meta.discourse.org/t/best-way-to-enforce-permissions-controller-or-constraint/176113)._
