Class: AuthManager::Finder

Inherits:
Constants show all
Defined in:
lib/auth_manager.rb,
lib/auth_manager/finder/finder.rb

Constant Summary

Constants inherited from Constants

Constants::APPS, Constants::USERS

Class Method Summary collapse

Class Method Details

.find_object?(param, option) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/auth_manager/finder/finder.rb', line 3

def self.find_object?( param, option )
  user = option.fetch(:user) || false
  app = option.fetch(:app) || false
  hash = hash_format_of(param, option)
  AuthManager::Validation.validate_param( hash )
  liste = user ? USERS : APPS
  hash_for_base = { object: hash[:object], list: 'users' } if hash[:option][:user]
  hash_for_base = { object: hash[:object], list: 'applications' } if hash[:option][:app]
  response = {}
  response = exist?(hash_for_base)
  response[:code] == 200 ? true : false
end