Class: Auth

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

Overview

Class to handle authorization related SAP information

Author:

  • Rogerio Nascimento (26/03/2021)

Class Method Summary collapse

Class Method Details

.for_object(*options) ⇒ Array

Return a list of users with authorization for an object

Parameters:

  • json

    containing authorization object and optionaly the tuples with field and value to be checked

Returns:

  • (Array)

    an array of strings with the list of users



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/auth.rb', line 10

def self.for_object(*options)
  users = []
  conn, obj, field1, value1, field2, value2 = validate_options(options)
  return users unless conn && obj

  ## Busca o AUTH na tabela UST12
  ust12_list = Auth.auth_list(conn, obj, field1, value1, field2, value2)
  return users unless ust12_list

  ## Busca o PROFN na tabela UST10S
  ust10s_list = Auth.profile_list(conn, obj, ust12_list)

  ## Busca os Usuários na tabela UST04
  Auth.user_list(conn, obj, ust10s_list)
end

.profiles_for_composite(conn, list = []) ⇒ Object

Select Authorization roles for the Profile

Parameters:

  • list (defaults to: [])

    List of profiles to be searched



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/auth.rb', line 30

def self.profiles_for_composite(conn, list = [])
  return [] if list.empty?

  fname = conn.conn.get_function('SIAG_PROF_GET_AUTH')
  fcall = fname.get_function_call

  fcall[:IV_PROFILE_TYPE] = 'C'
  list.each do |prof|
    row = fcall[:IT_PROFILE_RANGE].new_row
    row[:SIGN] = 'I'
    row[:OPTION] = 'EQ'
    row[:LOW] = prof
  end

  fcall.invoke

  ret = []
  fcall[:ET_COMPOSITE_PROFILE].each do |row|
    ret.push(row[:SINGLE_PROFILE])
  end

  ret
end