update2webdb.p 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. FOR EACH benutzer:
  2. FIND users
  3. WHERE users.user_name = benutzer.benutzer NO-ERROR.
  4. IF NOT AVAILABLE users THEN
  5. DO:
  6. CREATE users.
  7. ASSIGN
  8. users.user_name = benutzer.benutzer.
  9. END.
  10. ASSIGN
  11. users.display_name = benutzer.anzeige
  12. users.ROLE = (IF benutzer.admin THEN 'admin' ELSE 'user')
  13. users.ACTIVE = TRUE
  14. users.language_id = benutzer.sprcd
  15. users.company = benutzer.firma
  16. .
  17. END.
  18. FOR EACH Sprache:
  19. FIND LANGUAGES
  20. WHERE LANGUAGES.language_id = Sprache.Sprcd.
  21. IF NOT AVAILABLE LANGUAGES THEN
  22. DO:
  23. CREATE LANGUAGES.
  24. ASSIGN LANGUAGES.language_id = Sprache.Sprcd.
  25. END.
  26. ASSIGN
  27. LANGUAGES.LANGUAGE_name = Sprache.Bez.
  28. END.
  29. FOR EACH Mandant:
  30. FIND companies
  31. WHERE companies.company = Mandant.Firma.
  32. IF NOT AVAILABLE companies THEN
  33. DO:
  34. CREATE companies.
  35. ASSIGN companies.company = Mandant.Firma.
  36. END.
  37. ASSIGN
  38. companies.company_name = Mandant.NAME.
  39. END.
  40. FOR EACH Berecht:
  41. FIND userauthorization
  42. WHERE userauthorization.company = berecht.mandant
  43. AND userauthorization.user_name = berecht.benutzer
  44. AND userauthorization.program = berecht.programm NO-ERROR.
  45. IF NOT AVAILABLE userauthorization THEN
  46. DO:
  47. CREATE userauthorization.
  48. ASSIGN
  49. userauthorization.company = berecht.mandant
  50. userauthorization.user_name = berecht.benutzer
  51. userauthorization.program = berecht.programm.
  52. END.
  53. ASSIGN
  54. userauthorization.lcreate = berecht.pwe
  55. userauthorization.ldelete = berecht.pwl
  56. userauthorization.lquery = berecht.pwa
  57. userauthorization.lspecial = berecht.pws
  58. userauthorization.lupdate = berecht.pwm.
  59. END.