Class: Fog::Bouncer::Sources::Group
- Inherits:
-
Fog::Bouncer::Source
- Object
- Fog::Bouncer::Source
- Fog::Bouncer::Sources::Group
- Defined in:
- lib/fog/bouncer/sources.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#user_alias ⇒ Object
readonly
Returns the value of attribute user_alias.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Attributes inherited from Fog::Bouncer::Source
#group, #local, #remote, #source
Instance Method Summary collapse
-
#initialize(source, group, &block) ⇒ Group
constructor
A new instance of Group.
- #match(source) ⇒ Object
Methods inherited from Fog::Bouncer::Source
#==, #add_protocol, #extras, #inspect, #local?, #missing, #protocols, #remote?
Constructor Details
#initialize(source, group, &block) ⇒ Group
Returns a new instance of Group.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fog/bouncer/sources.rb', line 40 def initialize(source, group, &block) super case source when /^(.+)@(.+)$/ @name = $1 @user_alias = $2 if @user_alias[/^\d+$/] @user_id = @user_alias if account = group.security.accounts.find { |key, id| id == @user_id } @user_alias = account[0] end end else @name = source @user_alias = 'self' end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
38 39 40 |
# File 'lib/fog/bouncer/sources.rb', line 38 def name @name end |
#user_alias ⇒ Object (readonly)
Returns the value of attribute user_alias.
38 39 40 |
# File 'lib/fog/bouncer/sources.rb', line 38 def user_alias @user_alias end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
38 39 40 |
# File 'lib/fog/bouncer/sources.rb', line 38 def user_id @user_id end |
Instance Method Details
#match(source) ⇒ Object
58 59 60 |
# File 'lib/fog/bouncer/sources.rb', line 58 def match(source) "#{name}@#{user_id}" == source || "#{name}@#{user_alias}" == source || name == source end |