User has no access to Component Interface - Security

Use the following to compare a user that does have access to a user that doesn't. Provide the user that does, the user that doesn't, and the CI name.

Will return the Role, Permission List that is missing.


select * from (
select
  r.rolename
, c.oprclass
, ci.bcname
from
  PSOPRCLS c
, PSROLECLASS r
, PSAUTHBUSCOMP ci
where c.oprid = 'E87637'  -- User that DOES have access.
and r.classid = c.oprclass
and ci.classid = c.oprclass

minus

select
  r.rolename
, c.oprclass
, ci.bcname
from
  PSOPRCLS c
, PSROLECLASS r
, PSAUTHBUSCOMP ci
where c.oprid = 'S3286436' -- User that is missing access
and r.classid = c.oprclass
and ci.classid = c.oprclass

--) where bcname like 'HCR_PERSONAL_DATA_SRV'
) where bcname like 'AMS_CI_CHESSN_DATA'

Handling XML Files in SQR

Nice little example of reading an XML file, {input}, and using it to update values in a Table. Note that it first inserts the XML file's data into a CLOB field at the end of the Table it is updating. Field.RAWXML.


!*******************************************************************************
! Procedure:  Read-Input-File                                                  *
! Description: Loads Request File data into Suspense tables                    *
!              using Oracle XML DB functions to extract data from the XML      *      
!*******************************************************************************
!
begin-procedure Read-Input-File    

#debugp show ''
#debugp show 'Enter procedure Read-Input-File'

  ! Read file in 
  open $Request_Filename as {INPUT} for-reading record=32767:fixed_nolf status=#result
  if #result <> 0
    show {REQUEST_FILE_OPEN_ERR_MSG}
    stop quiet
  end-if

  let $SQL-STATEMENT = 'amssr197.sqr, Read-Input-File, insert into PS_AMS_CART_RQ_HDR' 
  
begin-sql on-error=Sql-Error
INSERT INTO PS_AMS_CART_RQ_HDR (
        PRCSINSTANCE,
        AMS_SYSTEM_CODE,
        AMS_CART_TIME_STMP,
        AMS_ABN_NBR,
        AMS_CART_USER_ID,
        AMS_CART_RECS,
        RAWXML
   ) values ( 
        #prcs_process_instance,
        ' ',
        0,
        0,
        ' ',
        0,
        empty_clob()
    )        
end-sql

  
  while 1=1
    let $xml = ''
    read {INPUT} into $xml:32767 status=#result
    
    if #result <> 0
        show {SUSPENSE_TABLE_ERR_MSG}
        stop quiet
    end-if
    if #end-file
        break
    end-if
    
        let #xml = length($xml)
        
    ! Begin: QC1555
    ! The given XML file may have Microsoft Byte Order Mark at the beginning. If so just trim it off else can't be read.
    ! http://en.wikipedia.org/wiki/UTF-8#Byte_order_mark
    let $checkBOM = substr($xml, 1,4) 
    if $checkBOM = '0xEF' or $checkBOM = '0xBB' or $checkBOM = '0xBF'
        let $xml = substr($xml, 5, #xml - 4)
    end-if 
    let $checkBOM = substr($xml, 1,3) 
    if $checkBOM = '' 
        let $xml = substr($xml, 4, #xml - 3)
    end-if
    let #xml = length($xml)
    ! End: QC1555
    
#ifdef debugx
         show '$checkBOM= ' $checkBOM
        show '    xml : ' $xml
#endif 

    let $SQL-STATEMENT = 'amssr197.sqr, Read-Input-File, update PS_AMS_CART_RQ_HDR(RAWXML)' 
  
begin-sql on-error=Sql-Error
declare
    cartXml CLOB;;
begin
    SELECT rawXML INTO cartXML
    FROM PS_AMS_CART_RQ_HDR 
    WHERE PRCSINSTANCE = #prcs_process_instance
    FOR UPDATE;;
    
    DBMS_LOB.WRITEAPPEND(cartXml, #xml, $xml);;
end;;
end-sql
#ifdef debugx
    commit
#endif

  end-while
  
  let $SQL-STATEMENT = 'amssr197.sqr, Read-Input-File, select PS_AMS_CART_RQ_HDR' 
  
begin-select on-error=Sql-Error
hdr.systemCode
hdr.cartTimeStamp
hdr.instAbn
hdr.userId
hdr.numRecords

   FROM 
   XMLTABLE('/studentStudyCircRequest005'
      PASSING (SELECT XMLTYPE.createxml(rawXML) FROM PS_AMS_CART_RQ_HDR WHERE PRCSINSTANCE = #prcs_process_instance) 
      COLUMNS
        systemCode      varchar2(4)  PATH 'header/system',
        cartTimeStamp   number(14,0) PATH 'header/timestamp',
        instAbn         number(11,0) PATH 'header/instAbn',
        userId          varchar2(12) PATH 'header/userId',
        numRecords      number(38,0) PATH 'trailer/numRecords'
        ) hdr
end-select

    let $SQL-STATEMENT = 'amssr197.sqr, Read-Input-File, update PS_AMS_CART_RQ_HDR' 
  
begin-sql !on-error=Sql-Error
UPDATE PS_AMS_CART_RQ_HDR 
        set AMS_SYSTEM_CODE    = &hdr.systemCode,
            AMS_CART_TIME_STMP = &hdr.cartTimeStamp,
            AMS_ABN_NBR        = &hdr.instAbn,
            AMS_CART_USER_ID   = &hdr.userId,
            AMS_CART_RECS      = &hdr.numRecords
   WHERE PRCSINSTANCE = #prcs_process_instance 
end-sql   

Redirecting a User after Login / Logon

This situation can be common in places like Universities. Students need to be redirected after login to some 'special' page, or an employee needs to be redirected if it is their first login, etcetera.

You could be forgiven for thinking this might be easily configurable somewhere. It doesn't seem to be (leave me a message if it is). Here's how I've done it.

I've modified:
AppPackage.PT_BRANDING


Note You're going to need a Global Variable to hold whether the user has been redirected yet or not, we only want to redirect once. You could easily put them into an endless redirect loop.

Global boolean &blnStudentHasBeenRedirected;

(You have to place that just after end-class;)

There is a Method getHomepageJS that, as its name implies, get JavaScript for the home page.
Return GetHTMLText(HTML.PT_HP2_JS_INCLUDE, &cookieJS, &refreshJS, &refreshPgltJS, &saveWarnCrossDomainJS, &saveWarnJS, &hpDndJS | Char(10) | Char(13) | %This.getCSSOverride());


Note the getCSSOverride method. This is where I've added my extra JavaScript, the 6th bind variable.

method getCSSOverride
   /+ Returns String +/
   
   /* derived classes can override this method to add their own css override */
   Local string &override = "";
   If %Request.BrowserType = "IE" Then
      &override = "<!--[if lt IE 9]>" | Char(10) | Char(13) | "<script type=""text/javascript"" src=""" | %Response.GetJavaScriptURL(HTML.AMS_IE9) | """></script>" | Char(10) | Char(13) | "<![endif]-->";
   End-If;
   Local AMS_PT_BRANDING:AmsHeader &myAmsHeader = create AMS_PT_BRANDING:AmsHeader();
   If &myAmsHeader.isStudent Then
      &override = &override | Char(10) | Char(13) | "<link rel=""stylesheet"" href=""" | %Response.GetStyleSheetURL(StyleSheet.AMS_SSS_STYLE_REF) | """ type=""text/css"">";
      
      /* Begin: QC1302 */
      If &blnStudentHasBeenRedirected <> True Then
         &blnStudentHasBeenRedirected = True;
         &override = &override | Char(10) | Char(13) | "<script type=""text/javascript"">window.top.location.replace(""../c/AMS_EOL.AMSW3_STDNT_HOME.GBL"");</script>";
      End-If;
      /* End: QC1302 */
      
   End-If;
   Return &override;
end-method;

If they're a student, and they haven't already been redirected once, redirect them to the student home page.





Data Integrity Error

Data Integrity Error (124,85)
The data structure from the page does not match the data structure in the database. This can be caused by... yada yada

This error usually appears after you've made some changes to PeopleCode or similar, and you haven't refreshed the page yet. As a developer you see it all the time and just reload the Component.

However, on some rare occasions it appears out of nowhere for a given Component. And it won't go away. And there's no reason for it.


  • Run a trace file for each SQL statement.
Search the trace file for 'Deserialization integrity failure'

Some googling about the deserialization error suggested we clear the Application Server cache and restart it. If that failed run the AppEngine VERSION. This app engine looked, at a glance, to be resetting the VERSION number of some major Tables back to 1. I didn't want to run this without knowing what all this VERSION stuff is.

Update: The correct method to resolve this issue is detailed here:http://peoplesoft-admin.rakeshparwal.com/2008/01/how-and-when-to-run-version-application.html

Solution: I opened the DERIVED_GBL Record and modified the comment. Saved. Fixed.
I think this was the least intrusive approach.

If you can expand on what the issue is and how to "correctly" fix it please leave a note below. Much appreciated.

Content Reference Menu Path SQL

Graciously lifted from Jim's PeopleSoft Journal (check out his book too).
http://jjmpsj.blogspot.com.au/2007/12/query-for-component-andor-cref.html


WITH PORTAL_REGISTRY AS (
SELECT RTRIM(REVERSE(SYS_CONNECT_BY_PATH(REVERSE(PORTAL_LABEL), ' >> ')), ' >> ') PATH
     , LEVEL LVL
  FROM PSPRSMDEFN
 WHERE PORTAL_NAME = 'EMPLOYEE'
 START WITH PORTAL_OBJNAME = &1
CONNECT BY PRIOR PORTAL_PRNTOBJNAME = PORTAL_OBJNAME )
SELECT PATH
  FROM PORTAL_REGISTRY
 WHERE LVL = (
SELECT MAX(LVL)
  FROM PORTAL_REGISTRY )

Custom Homepage Pagelets / Custom Navigation Collections

Great article:
http://peoplesofttipster.com/2009/04/27/applying-homepage-pagelets-to-others/

Change Font in SQR


Sometimes the easiest things...

begin-program
   alter-printer font=4 ! hp laser, helvetica
   ...