Module: Maestrano::SSO::Group

Defined in:
lib/maestrano/sso/group.rb

Instance Method Summary collapse

Instance Method Details

#find_for_maestrano_auth(auth) ⇒ Object

Raises:

  • (NoMethodError)


4
5
6
7
8
9
10
11
12
13
# File 'lib/maestrano/sso/group.rb', line 4

def find_for_maestrano_auth(auth)
  # E.g with Rails
  # where(auth.slice(:provider, :uid)).first_or_create do |group|
  #   group.provider = auth[:provider]
  #   group.uid = auth[:uid]
  #   group.name = (auth[:info][:company_name] || 'Your Group')
  #   group.country = auth[:info][:country]
  # end
  raise NoMethodError, "You need to override find_for_maestrano_auth in your #{self.class.name} model"
end

#maestrano?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
# File 'lib/maestrano/sso/group.rb', line 15

def maestrano?
  if self.respond_to?(:provider)
    return self.provider.to_s == 'maestrano'
  else
    raise NoMethodError, "You need to override maestrano? in your #{self.class.name} model"
  end
end