Главная > API, Oracle e-Business Suite, SQL > API добавления полномочия для пользователя


API добавления полномочия для пользователя

С помощью данного API можно добавить полномочие пользователю

begin
  -- Call the procedure
  fnd_user_pkg.addresp(username       => :username,
                       resp_app       => :resp_app,
                       resp_key       => :resp_key,
                       security_group => :security_group, -- в основном 'STANDARD'
                       description    => :description,    -- любой коммент
                       start_date     => :start_date,
                       end_date       => :end_date);
  commit;                    
  dbms_output.put_line('Responsibility Added Successfully');
exception
 when others then
   dbms_output.put_line(' Responsibility is not added due to ' 
                        || substr(SQLERRM, 1, 100));
   rollback;
end;

И весьма полезный скрипт, c помощью которого можно быстро перетянуть полномочия с одного инстанса на другой.

declare
 l_user_name varchar2(100) := 'USER_NAME';
begin
  dbms_output.put_line('BEGIN');
  -- цикл по списку полномочий пользователя  
  for i in (select  'fnd_user_pkg.addresp('''||u.user_name||''', '''
                     || a.application_short_name ||''', '''
                     || r.responsibility_key ||''', '''
                     || 'STANDARD' ||''', '''
                     || 'Add by script' ||''', '
                     || 'sysdate' ||', '  
                     || 'null' ||');'          
                   as script
                  , r.responsibility_name
              from fnd_user              u
                  ,fnd_user_resp_groups  g
                  ,fnd_application_vl    a
                  ,fnd_responsibility_vl r
             where g.user_id(+) = u.user_id
               and g.responsibility_application_id = a.application_id
               and a.application_id = r.application_id
               and g.responsibility_id = r.responsibility_id
               AND u.user_name = l_user_name
            )
  loop
    dbms_output.put_line('  dbms_output.put_line('''||i.responsibility_name||''');');    
    dbms_output.put_line('  '||i.script);
    dbms_output.put_line('');
  end loop;
  dbms_output.put_line('  commit;');
  dbms_output.put_line('  dbms_output.put_line('''');');
  dbms_output.put_line('  dbms_output.put_line(''Responsibility Added Successfully'');');
  dbms_output.put_line('EXCEPTION');
  dbms_output.put_line('  when others then');     
  dbms_output.put_line('     dbms_output.put_line('' Responsibility is not added due to '' || substr(SQLERRM, 1, 100));');     
  dbms_output.put_line('     rollback;');
  dbms_output.put_line('END;');
end;

Похожие записи:

  1. alex
    7 Ноябрь 2011 в 17:23 | #1

    также весьма удобен fndload для того, чтобы перетянуть полномочия с одного инстанса на другой.

  2. 23 Март 2012 в 20:06 | #2

    Спасибо! Очень доходчиво все объяснено!

  1. Пока что нет уведомлений.