project QadFinancials > class BCompany > method ValidateComponentCheckSecurity
Description
check if the user has acces to the company that he will change, check if there is a role defined that gives you acces to change the company
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bcompany.p)
<Q-12 run UserCompanies
(Start) in BUser >
for each t_sCompany,
each tCompanyPropertyRef where
tCompanyPropertyRef.tc_ParentRowid = t_sCompany.tc_Rowid and
(tCompanyPropertyRef.tc_Status = "C":U or
tCompanyPropertyRef.tc_Status = "D":U) :
<Q-9 run UserCompanies (all) (Read) (NoCache)
(input vcUserLogin, (UserLogin)
input t_sCompany.Company_ID, (CyId)
input ?, (DomainId)
output dataset tqUserCompanies) in BUser >
assign vlOK = Can-find (First tqUserCompanies Where
tqUserCompanies.tiCompany_ID = t_sCompany.Company_ID).
if not vlOK
then do:
assign vcMessage = trim(#T-2'You do not have the relevant role access to modify this entity.':150(57445)t-2#)
oiReturnStatus = -1.
<M-3 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tCompanyPropertyRef.CompanyPropertyCode':U (icFieldName),
input tCompanyPropertyRef.CompanyPropertyCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input tCompanyPropertyRef.tc_rowid (icRowid),
input 'QADFIN-3900':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCompany>
end.
if vcActivityCode <> '':U
then do :
<M-5 run apiActivityIsAllowed
(input vcUserLogin (icUsrLogin),
input t_sCompany.CompanyCode (icCompanyCode),
input vcActivityCode (icActivityCode),
output vlIsAllowed (olIsAllowed),
output viFcReturnSuper (oiReturnStatus)) in BCompany>
if not vlIsAllowed
then do:
assign vcMessage = trim(#T-6'You do not have the relevant role access to modify this entity.':150(16026)t-6#)
oiReturnStatus = -1.
<M-7 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tCompanyPropertyRef.CompanyPropertyCode':U (icFieldName),
input tCompanyPropertyRef.CompanyPropertyCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input tCompanyPropertyRef.tc_rowid (icRowid),
input 'QADFIN-3901':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCompany>
end.
end. /* if vcActivityCode */
end. /* for each */
<Q-14 run UserCompanies
(Stop) in BUser >