Class: BBMB::Html::Util::KnownUser
- Inherits:
-
SBSM::User
- Object
- SBSM::User
- BBMB::Html::Util::KnownUser
- Defined in:
- lib/bbmb/html/util/known_user.rb
Constant Summary collapse
- PREFERENCE_KEYS =
[ :home, :pagestep ]
Instance Attribute Summary collapse
-
#auth_session ⇒ Object
readonly
Admin users need permissions for: login BBMB.config.auth_domain + ".Admin" edit yus.entities set_password grant login.
Instance Method Summary collapse
- #allowed?(action, key = nil) ⇒ Boolean
- #entity_valid?(email) ⇒ Boolean
-
#initialize(session) ⇒ KnownUser
constructor
A new instance of KnownUser.
- #navigation ⇒ Object
- #remote_call(method, *args, &block) ⇒ Object (also: #method_missing)
Constructor Details
#initialize(session) ⇒ KnownUser
Returns a new instance of KnownUser.
25 26 27 |
# File 'lib/bbmb/html/util/known_user.rb', line 25 def initialize(session) @auth_session = session end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#auth_session ⇒ Object (readonly)
Admin users need permissions for: login BBMB.config.auth_domain + ".Admin" edit yus.entities set_password grant login
Customers need permissions for: login BBMB.config.auth_domain + ".Customer"
18 19 20 |
# File 'lib/bbmb/html/util/known_user.rb', line 18 def auth_session @auth_session end |
Instance Method Details
#allowed?(action, key = nil) ⇒ Boolean
28 29 30 31 32 33 34 |
# File 'lib/bbmb/html/util/known_user.rb', line 28 def allowed?(action, key=nil) allowed = remote_call(:allowed?, action, key) BBMB.logger.debug('User') { sprintf('%s: allowed?(%s, %s) -> %s', name, action, key, allowed) } allowed end |
#entity_valid?(email) ⇒ Boolean
35 36 37 38 |
# File 'lib/bbmb/html/util/known_user.rb', line 35 def entity_valid?(email) !!(allowed?('edit', 'yus.entities') \ && (entity = remote_call(:find_entity, email)) && entity.valid?) end |
#navigation ⇒ Object
39 40 41 |
# File 'lib/bbmb/html/util/known_user.rb', line 39 def [ :logout ] end |