Class: OracleEbsAuthentication::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/oracle_ebs_authentication/authenticator.rb

Instance Method Summary collapse

Constructor Details

#initializeAuthenticator

Returns a new instance of Authenticator.



5
6
7
# File 'lib/oracle_ebs_authentication/authenticator.rb', line 5

def initialize
  @security = OracleEbsAuthentication::Security.new
end

Instance Method Details

#get_fnd_password(username, password) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/oracle_ebs_authentication/authenticator.rb', line 9

def get_fnd_password(username, password)
  username &&= username.upcase
  result = plsql.apps.fnd_security_pkg.fnd_encrypted_pwd(username, nil, nil, nil)
  if result[:p_password]
    @security.decrypt(username + "/" + password, result[:p_password], false)
  end
rescue OCIError => e
  if e.message.include?("ORA-20001: Your account does not exist or has expired.")
    nil
  else
    raise e
  end
end

#get_fnd_responsibilities(username) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/oracle_ebs_authentication/authenticator.rb', line 28

def get_fnd_responsibilities(username)
  user_id = get_fnd_user_id(username)
  if user_id
    plsql.select(:all, <<-SQL, user_id).map{|row| row[:responsibility_name]}
      SELECT r.responsibility_name
        FROM apps.fnd_user_resp_groups_all ur, apps.fnd_responsibility_vl r
       WHERE ur.user_id = :p_user_id
         AND TRUNC(SYSDATE) BETWEEN NVL(ur.start_date,TRUNC(SYSDATE)) AND NVL(ur.end_date, TRUNC(SYSDATE))
         AND ur.responsibility_id = r.responsibility_id
    SQL
  else
    []
  end
end

#get_fnd_user_id(username) ⇒ Object



23
24
25
26
# File 'lib/oracle_ebs_authentication/authenticator.rb', line 23

def get_fnd_user_id(username)
  username &&= username.upcase
  plsql.apps.fnd_security_pkg.fnd_encrypted_pwd(username, nil, nil, nil)[:p_user_id]
end

#validate_user_password(username, password) ⇒ Object



43
44
45
46
47
# File 'lib/oracle_ebs_authentication/authenticator.rb', line 43

def validate_user_password(username, password)
  if username && password
    !! get_fnd_password(username, password)
  end
end