icDomainCode | input | character | The code of the current domain you are working in. This paramater is mandatory. |
icSecurityArea | input | character | SecurityArea (corresponds with field Code_mstr.Code_FldName): the area on which you want security-information on (example "GLUSERID":U). This paramater is mandatory. |
icUserLogin | input | character | UserLogin: the login of the curent user |
iiSessionID | input | integer | SessionID of the calling class |
ocCompanyCodeList | output | character | CompanyCodeList: a comma-separated list of the CompanyCodes you have acces to for a certain Security-area. If the value of this parameter is *, then this means you have acces to all companies |
ocErrorMessage | output | character | In case the value of oiReturnStatus is negative (indicating an error), this paramater will contain the error-message. This is done as this technical class is not capable of performing a SetMessage |
oiReturnStatus | output | integer |
/* ==================================================================================================================================== */ /* Make sure the entity security (old aproach of MfgPro using the code_mstr table) that was implemented in this class will no longer be */ /* seable. As we do not want to remove this class (just in case ....), we will jsut add a message and a return in case this class would */ /* be used anyway. The new mechnaism will use the entity-security of the financials. */ /* ==================================================================================================================================== */ assign oiReturnStatus = -3 ocErrorMessage = trim(#T-14'Internal error: the entity security of the former MfgPro versions (using the code master table) is no longer applicable. The entity security of the Financials would not be used to handle this piece of functionality.':255(63351)t-14#). Return. /* * commenting out the code to prevent compile warning /* ================== */ /* Exception Handling */ /* ================== */ assign oiReturnStatus = -98. /* ========================================================================================== */ /* Assign the localy defined data-item as this is needed to perform query-calls. We will just */ /* assign this and the value of the class-reference to the input paramater iiSessionID */ /* ========================================================================================== */ assign viSessionID = iiSessionID viSessionFromTCompanySecID = iiSessionID. /* ========================== */ /* Check mandatory paramaters */ /* ========================== */ if icDomainCode = "":U or icDomainCode = ? or icSecurityArea = "":U or icSecurityArea = ? or icUserLogin = "":U or icUserLogin = ? then do : /* no messages possible in technical classes */ assign oiReturnStatus = -3 ocErrorMessage = trim(substitute(#T-10'An internal error occurred while running the entity security: Missing information on the Domain, Area and User that are the subject of this security check.':229(56582)t-10#)) + chr(10) + trim(substitute(#T-11'Domain: &1.':99(56583)T-11#,icDomainCode)) + chr(10) + trim(substitute(#T-12'Security area: &1.':99(56584)T-12#,icSecurityArea)) + chr(10) + trim(substitute(#T-13'User login: &1.':99(56585)T-13#,icUserLogin)). Return. end. /* if icDomainCode = "":U or */ /* ============================================================== */ /* CHECK IF ENTITY SECURITY IS BEING USED ON THIS AREA AND DOMAIN */ /* If this is not the case, then all companies are allowed */ /* ============================================================== */ <Q-8 assign vlFcQueryRecordsAvailable = GeneralizedCodeForSecurity (NoCache) (input icDomainCode, (DomainCode) input icSecurityArea, (CodeFldName) input '':U, (CodeValue)) in BMfgGeneralizedCode > if vlFcQueryRecordsAvailable = false then do : assign ocCompanyCodeList = "*":U oiReturnStatus = 0. Return. end. /* if vlFcQueryRecordsAvailable = false */ /* ============================================================== */ /* CHECK THE ENTITY SECURITY FOR THIS AREA, DOMAIN AND USER */ /* If nothing is found for this, then nothing is allowed */ /* If the record is found, then the code_cmmt field contain the */ /* comma-sep list of available companies or a * meaning all the */ /* companies are accessible */ /* ============================================================== */ <Q-9 run GeneralizedCodeForSecurity (first) (Read) (NoCache) (input icDomainCode, (DomainCode) input icSecurityArea, (CodeFldName) input icUserLogin, (CodeValue) output dataset tqGeneralizedCodeForSecurity) in BMfgGeneralizedCode > find first tqGeneralizedCodeForSecurity no-lock no-error. if not available tqGeneralizedCodeForSecurity then do : assign ocCompanyCodeList = "":U oiReturnStatus = 0. Return. end. /* if not available tqGeneralizedCodeForSecurity */ assign ocCompanyCodeList = (if tqGeneralizedCodeForSecurity.tccode_cmmt = ? then "":U else tqGeneralizedCodeForSecurity.tccode_cmmt). oiReturnStatus = 0. Return. /* ======================= */ /* Exception Handling = OK */ /* ======================= */ if oiReturnStatus = -99 then assign oiReturnStatus = 0. */ /* ================================================================================================== */ /* This piece of code stops the main-methos and created another procedure "gipr_RefreshInstanceData" */ /* that is ended by the generated end-statement for method Main */ /* This method is needed as for some reason as you otherwise get errors like: */ /* "program/tmfgentitysecurity.p has no entry point for gipr_RefreshInstanceData" */ /* ================================================================================================== */ end procedure. procedure gipr_RefreshInstanceData : define input parameter ihHandle as handle.