Class: Guide::Bouncer

Inherits:
Object
  • Object
show all
Defined in:
app/models/guide/bouncer.rb

Instance Method Summary collapse

Constructor Details

#initialize(authorisation_system:) ⇒ Bouncer

Returns a new instance of Bouncer.


2
3
4
# File 'app/models/guide/bouncer.rb', line 2

def initialize(authorisation_system:)
  @authorisation_system = authorisation_system
end

Instance Method Details

#user_can_access?(node) ⇒ Boolean

Returns:

  • (Boolean)

6
7
8
# File 'app/models/guide/bouncer.rb', line 6

def user_can_access?(node)
  visible_to_user?(node.id, node.options[:visibility])
end

#user_is_privileged?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'app/models/guide/bouncer.rb', line 10

def user_is_privileged?
  @authorisation_system.user_is_privileged?
end