Skip to content

Commit 68e3cc7

Browse files
committed
Registering the process of setting privileges for files
1 parent 6b8da8e commit 68e3cc7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

nsis/postgresql.nsi

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ Section $(PostgreSQLString) sec1
372372
;;;Pop $0 ;"ok" or "error" + error details
373373
;;;AccessControl::GrantOnFile "$DATA_DIR" "$loggedInUser" "FullAccess" ;GenericWrite
374374
;;;Pop $0 ;"ok" or "error" + error details
375+
DetailPrint "GRANT FullAccess ON $DATA_DIR TO $loggedInUserShort"
375376
AccessControl::GrantOnFile "$DATA_DIR" "$loggedInUserShort" "FullAccess"
376377
Pop $0
377378

@@ -387,6 +388,7 @@ Section $(PostgreSQLString) sec1
387388
DetailPrint "Database initialization ..."
388389
AccessControl::GetCurrentUserName
389390
Pop $0 ; or "error"
391+
DetailPrint "GRANT FullAccess ON $DATA_DIR TO $0"
390392
AccessControl::GrantOnFile "$DATA_DIR" "$0" "FullAccess" ;GenericWrite
391393
Pop $0 ;"ok" or "error" + error details
392394
System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("LC_MESSAGES", "C").r0'
@@ -466,24 +468,33 @@ Section $(PostgreSQLString) sec1
466468
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\$ServiceID_text" "DisplayName" "$ServiceID_text - PostgreSQL Server ${PG_MAJOR_VERSION}"
467469
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\$ServiceID_text" "Description" "Provides relational database storage."
468470

471+
DetailPrint "GRANT FullAccess ON $DATA_DIR TO $ServiceAccount_text"
469472
AccessControl::GrantOnFile "$DATA_DIR" "$ServiceAccount_text" "FullAccess"
470473
Pop $0 ;"ok" or "error" + error details
474+
DetailPrint "GRANT FullAccess ON $DATA_DIR TO $loggedInUser"
471475
AccessControl::GrantOnFile "$DATA_DIR" "$loggedInUser" "FullAccess" ;GenericWrite
472476
Pop $0 ;"ok" or "error" + error details
477+
DetailPrint "GRANT FullAccess ON $DATA_DIR TO $loggedInUserShort"
473478
AccessControl::GrantOnFile "$DATA_DIR" "$loggedInUserShort" "FullAccess" ;GenericWrite
474479
Pop $0 ;"ok" or "error" + error details
475480

481+
DetailPrint "GRANT GenericRead + GenericExecute ON $INSTDIR TO $ServiceAccount_text"
476482
AccessControl::GrantOnFile "$INSTDIR" "$ServiceAccount_text" "GenericRead + GenericExecute"
477483
Pop $0 ;"ok" or "error" + error details
478484

485+
DetailPrint "GRANT FullAccess ON $DATA_DIR\postgresql.conf TO $ServiceAccount_text"
479486
AccessControl::GrantOnFile "$DATA_DIR\postgresql.conf" "$ServiceAccount_text" "FullAccess"
480487
Pop $0 ;"ok" or "error" + error details
488+
DetailPrint "GRANT FullAccess ON $DATA_DIR\postgresql.conf TO $loggedInUser"
481489
AccessControl::GrantOnFile "$DATA_DIR\postgresql.conf" "$loggedInUser" "FullAccess" ;"GenericRead + GenericExecute" ;GenericWrite
482490
Pop $0 ;"ok" or "error" + error details
491+
DetailPrint "GRANT FullAccess ON $DATA_DIR\postgresql.conf TO $loggedInUserShort"
483492
AccessControl::GrantOnFile "$DATA_DIR\postgresql.conf" "$loggedInUserShort" "FullAccess" ;GenericWrite
484493
Pop $0 ;"ok" or "error" + error details
485494

495+
DetailPrint "GRANT FullAccess ON $INSTDIR\scripts TO $loggedInUser"
486496
AccessControl::GrantOnFile "$INSTDIR\scripts" "$loggedInUser" "FullAccess"
497+
DetailPrint "GRANT GenericRead + GenericExecute ON $INSTDIR\scripts\pgpro_upgrade.cmd TO $loggedInUser"
487498
AccessControl::GrantOnFile "$INSTDIR\scripts\pgpro_upgrade.cmd" "$loggedInUser" "GenericRead + GenericExecute"
488499
Pop $0 ;"ok" or "error" + error details
489500
${if} $isDataDirExist == 1
@@ -559,7 +570,7 @@ Section $(PostgreSQLString) sec1
559570
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PGUSER" "$UserName_text"
560571
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PGPORT" "$TextPort_text"
561572
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PGLOCALEDIR" "$INSTDIR\share\locale\"
562-
AddToPath::AddToPath "$INSTDIR\bin"
573+
AddToPath::AddToPath "$INSTDIR\bin"
563574
${endif}
564575
SectionEnd
565576

0 commit comments

Comments
 (0)