Module: CubaApi::Guard
- Defined in:
- lib/cuba_api/guard.rb
Instance Method Summary collapse
Instance Method Details
#allowed?(*group_names) ⇒ Boolean
26 27 28 |
# File 'lib/cuba_api/guard.rb', line 26 def allowed?( *group_names ) authenticated? && ( allowed_groups( *group_names ).size > 0 ) end |
#allowed_groups(*group_names) ⇒ Object
30 31 32 |
# File 'lib/cuba_api/guard.rb', line 30 def allowed_groups( *group_names ) current_groups.select { |g| group_names.member?( g.name ) } end |
#current_groups ⇒ Object
34 35 36 |
# File 'lib/cuba_api/guard.rb', line 34 def current_groups current_user.groups end |