Enterprise Mgmt.: How to force an authentication to verify the current session's user credentials

1 minute read time.

You might have a business need to verify the current session's user credentials before certain actions are taken.

This requirement exists for certain industries (such as CFR 21-11 in pharmaceutical industry) to force in some cases an authentication (in order to secure some modifications).

Starting with V11 there is an API developed which can give you this option, below is an example of using ASYRFNC.ACHECKCONNECT

Before we get to the example , you can read more about this API in online help by searching for "Manage user authentication"

So imagine you have a requirement, that every time payment terms is changed in customer function, the user has to enter their Syracuse password to re-verify their identity. Below i how you accomplish this:

  1. Open Development, Script dictionary , Screens, Screens. 
  2. Select BPC3 screen. 
  3. Click on Fields tab and locate PTE (payment term) field and add a custom control action. 



  4. Save  and Validate.
  5. Open Development, Script Dictionary, Scripts, Script editor. 
  6. Enter SPEBPC and add the following code. 


    Subprog C_PTE(VALEUR)
    Variable Char VALEUR()
    Local Integer OK,ASTATUS
    Local Char PASS
    local Char MSG(200)

    #Prompt user for Password
    #This is a reusable program for prompting for a field
    Call SAICAR(PASS,"Enter the signature password","Password","A",0,20,"",OK) From GESECRAN

    If OK = 2
    # this is the call to ASYRFNC.ACHECKCONNECT that checks to find out if the password entered is correct or not
    ASTATUS=func ASYRFNC.ACHECKCONNECT(GACTX, PASS,MSG)
    If ASTATUS>=[V]CST_AERROR

    infbox("You are not allowed to make this change, Your password did not match")
    # reverting payment term to the old value
    VALEUR =[M:BPC3]PTE
    AFFZO [M:BPC3]PTE
    Endif
    Endif
    End

  7. Save  and Compile.
  8. Now open Common Data , BPs, Customers. 
  9. Select an existing customer. 
  10. Click on Financial tab. 
  11. Select a new term for the payment term field. 
  12. After tabbing you will see below, which is a prompt for user to re-enter their Syracuse password.



  13. If the password is correct, the new payment term is accepted and the focus goes to next field, but if the password entered is incorrect, user will see below and term is reverted back to the old term. 




Conclusion: You can use ASYRFNC.ACHECKCONNECT to re-verify users password when certain action happens.