Changes between Version 1 and Version 2 of scriptHell


Ignore:
Timestamp:
06/19/17 16:24:38 (7 years ago)
Author:
lttoth@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • scriptHell

    v1 v2  
    11= Creating, Modifying, or Deleting ZUAUSR Processing Scripts = 
     2== Overview == 
     3Several steps are taken to add new script functions. 
     4* Add Script data to ~/users/zu/zuausr/appworx/SCRIPT.pm 
     5* Create appropriate SQL script in /ZUAUSR/product/PROD/bin to perform the work 
     6* Create ZUAUSR Base Class 
     7* Associate Base Class to SUPER class 
     8 
     9== Add Script data to ~/users/zu/zuausr/appworx/SCRIPT.pm == 
     10The following template is repeated through SCRIPT.pm.  To include a new script, add a section with the following format substituting the new script information for: 
     11* GRANT_BANPROXY : name of the ZUAUSR base class 
     12* zua_grant_banproxy : name associated to the SQL script under /ZUAUSR/product/PROD/bin 
     13{{{ 
     14    # process GRANT_BANPROXY "script" 
     15    elsif ( $process_ind eq $::process_ind_add and $class_name eq 'GRANT_BANPROXY' ) { 
     16 
     17        # verify no pending BANNER processing 
     18        # (procedure says process GRANT_BANPROXY only if BANNER processing completed) 
     19 
     20        my $continue = &::verify_banner( @data ); 
     21        if ( $continue == $::failure ) { 
     22                $process_status = $::skipped; 
     23                $status_msg = "BANNER processing pending"; 
     24                return ( $process_status, $status_msg ); 
     25        } 
     26 
     27        $script_command = "BEGIN\n:result := zua_grant_banproxy(\'$userid\');\nEND;"; 
     28        $status_msg = &execute_db_procedure ( $script_command, $class_inst ); 
     29        if ( $status_msg =~ m/Success/ ) { return ( $::status_ind_completed, $status_msg ) } 
     30        else { return ( $::status_ind_processing_failure, $status_msg ) } 
     31    } 
     32 
     33}}} 
     34 
     35== Create Appropriate SQL Script == 
     36The reference in SCRIPT.pm, ''$script_command = "BEGIN\n:result := zua_grant_banproxy(\'$userid\');\nEND;";'', refers to a SQL script located at /ZUAUSR/product/PROD/bin.  Actions that effect change to Banner or ORACLE are encoded into scripts at the PROD location.  PROD is the only instance of ZUAUSR running, even if other instances contain copies of some relevant files.   
     37 
     38SQL scripts that are of type SCRIPT follow a pattern.  The scripts follow clear checking to be sure the user is not terminated, that the user has basic pre-requisite roles granted, and that the user does not already have the role set.   
     39 
     40=== Script Comparison for Similar Functionality ===  
     41The following excerpts show the places in which the scripts differ where the functions are essentially the same.  Each of these files are 171 lines; most of the lines in the two scripts are identical. 
     42{{{ 
     43< rem TITLE:            zua_grant_banproxy.sql 
     44< rem DESCRIPTION:      script to create the zua_grant_banproxy function to  
     45< rem                     grant connect through BANPROXY to users for Banner9 
     46--- 
     47> rem TITLE:            zua_grant_banjsproxy.sql 
     48> rem DESCRIPTION:      script to create the zua_grant_banjsproxy function to  
     49> rem                      grant connect through BANJSPROXY to users for Banner9 
     50 
     51}}} 
     52{{{ 
     53< Program: grant_banproxy 
     54< Purpose:  Grant connect through BANPROXY to users for Banner9 access 
     55--- 
     56> Program: grant_banjsproxy 
     57> Purpose:  Grant connect through BANJSPROXY to users for Banner9 access 
     58}}} 
     59{{{ 
     60< create or replace function zua_grant_banproxy ( parm1 varchar2, debug_flag IN boolean := FALSE ) 
     61--- 
     62> create or replace function zua_grant_banjsproxy ( parm1 varchar2, debug_flag IN boolean := FALSE ) 
     63}}} 
     64{{{ 
     65<   execute immediate 'alter user ' || v_uname || ' grant connect through banproxy'; 
     66< 
     67<   rc_msg := success_msg||': '||'CONNECT through BANPROXY granted'; 
     68--- 
     69>   execute immediate 'alter user ' || v_uname || ' grant connect through banjsproxy'; 
     70> 
     71>   rc_msg := success_msg||': '||'CONNECT through BANJSPROXY granted'; 
     72 
     73}}} 
     74 
     75=== Script Comparison for Different Functionality === 
     76 
     77The following exemplifies the fact that the script's function ultimately defines it's contents.  Yet, the difference in line number is 171 to 208.  The bulk of the SQL code is the same.  
     78{{{ 
     79< rem TITLE:            zua_grant_banproxy.sql 
     80< rem DESCRIPTION:      script to create the zua_grant_banproxy function to  
     81< rem                     grant connect through BANPROXY to users for Banner9 
     82--- 
     83> rem TITLE:            zua_insert_gurusri.sql 
     84> rem DESCRIPTION:      script to create the zua_insert_gurusri function to  
     85> rem                     insert a row into BANSECR.GURUSRI for MEP 
     8617,18c17,18 
     87< Program: grant_banproxy 
     88< Purpose:  Grant connect through BANPROXY to users for Banner9 access 
     89--- 
     90> Program: insert_gurusri 
     91> Purpose: Insert a row into GURUSRI to give users a default campus for MEP  
     9222c22 
     93< create or replace function zua_grant_banproxy ( parm1 varchar2, debug_flag IN boolean := FALSE ) 
     94--- 
     95> create or replace function zua_insert_gurusri ( parm1 varchar2, debug_flag IN boolean := FALSE ) 
     9625a26,27 
     97>   v_uinit varchar2(2); 
     98>   v_vpdi  varchar2(6); 
     9945c47,49 
     100<         WHERE USERNAME LIKE user_in; 
     101--- 
     102>         WHERE USERNAME LIKE user_in 
     103>         and not exists (select 'y' from bansecr.gurusri 
     104>         where gurusri_vpdi_user_id = username); 
     105137c141,144 
     106<   close sel_username_cursor; 
     107--- 
     108>   LOOP 
     109>     BEGIN 
     110>     v_uinit := substr(v_uname,1,2); 
     111>     v_vpdi := 'UAA'; 
     112139c146,172 
     113<   execute immediate 'alter user ' || v_uname || ' grant connect through banproxy'; 
     114--- 
     115>     if v_uinit in ('AF','AH','AN','AY','VN','VF','DN','DF','IN','IF','IH','PN','PF','PY') or 
     116>        v_uname in('VRSX10','VRSX20','VRSX1','VRSX2') or 
     117>        v_uname like('OPS$AXRE%') or  
     118>        v_uname like('KIKEN%') or 
     119>        v_uname like('KIANC%') then 
     120>           v_vpdi := 'UAA'; 
     121>     elsif v_uinit in ('EF','EN','FF','FH','FN','FY','LF','LN','NN','NF', 
     122>                    'RN','RF','ZN','ZF') or 
     123>        v_uname in('VRSX30','VRSX40','VRSX3','VRSX4') or 
     124>        v_uname like('OPS$FXRE%') or 
     125>        v_uname like('KIFBK%') then 
     126>           v_vpdi := 'UAF'; 
     127>     elsif v_uinit in ('JY','JN','JF','JH','TF','TN','KN','KF') or 
     128>        v_uname in('VRSX50','VRSX60','VRSX5','VRSX6') or 
     129>        v_uname like('OPS$JXRE%') or 
     130>        v_uname like('KIJUN%') then 
     131>           v_vpdi := 'UAS'; 
     132>     else  
     133>           v_vpdi := 'UAA'; 
     134>     end if; 
     135>     insert into bansecr.gurusri (gurusri_vpdi_user_id, gurusri_vpdi_code, gurusri_user_def_inst_ind,  
     136>                                  gurusri_activity_date,gurusri_user_id,gurusri_data_origin) 
     137>     values(v_uname,v_vpdi,'Y',sysdate,'ZUAUSR',NULL); 
     138>    END; 
     139>    FETCH SEL_USERNAME_CURSOR into v_uname; 
     140>    EXIT WHEN sel_username_cursor%notfound; 
     141>   END LOOP; 
     142141c174,178 
     143<   rc_msg := success_msg||': '||'CONNECT through BANPROXY granted'; 
     144--- 
     145>   IF sel_username_cursor%isopen 
     146>   THEN close sel_username_cursor; 
     147>   END IF; 
     148>    
     149>   rc_msg := success_msg||': '||'ID inserted into BANSECR.GURUSRI'; 
     150 
     151}}} 
     152