| Conditions | 2 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # frozen_string_literal: true |
||
| 24 | def disabled_roles(user) |
||
| 25 | current_user_role = current_user.highest_priority_role |
||
| 26 | |||
| 27 | disallowed_roles = if current_user_role.name == "admin" |
||
| 28 | Role.editable_roles(@user_domain).where("priority < #{current_user_role.priority}") |
||
| 29 | .pluck(:id) |
||
| 30 | else |
||
| 31 | Role.editable_roles(@user_domain).where("priority <= #{current_user_role.priority}") |
||
| 32 | .pluck(:id) |
||
| 33 | end |
||
| 34 | |||
| 35 | user.roles.by_priority.pluck(:id) | disallowed_roles |
||
| 36 | end |
||
| 37 | end |
||
| 38 |