ggreen86 / XLSX-Workbook-Class

VFP Class to Create an XLSX Workbook without Excel Automation or Installed
45 stars 16 forks source link

File Permissions #76

Closed srrbach closed 1 year ago

srrbach commented 1 year ago

Hello - Just started using this and it's pretty simple and easy to use thank you! We are having 1 problem with it and that after we call

    oExcel.saveWorkbook(m.workBook) 

the 'Authenticated Users' is missing under the security tab. Normally I wouldn't care but we are using this with Rick Strahl's web connect and in IIS if it's missing that user then it causes problems accessing the file (says unathorized). Do you know what would cause this? I tested and any time in VFP when we do a

copy to ..\myPath\test.xls type xls

that user name is present. Any thoughts?

image image

ggreen86 commented 1 year ago

Hello--

At what point is the error occurring? Is the error being caught by the TRY-CATCH? If so, what is the exception message and at what step in the code (method and step number)? Possibly it is when the temporary files are being created in the user's TEMP folder.

Greg


From: srrbach @.> Sent: Wednesday, November 16, 2022 4:55 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: [ggreen86/XLSX-Workbook-Class] File Permissions (Issue #76)

Hello - Just started using this and it's pretty simple and easy to use thank you! We are having 1 problem with it and that after we call

    oExcel.saveWorkbook(m.workBook)

the 'Authenticated Users' is missing under the security tab. Normally I wouldn't care but we are using this with Rick Strahl's web connect and in IIS if it's missing that user then it causes problems accessing the file (says unathorized). Do you know what would cause this? I tested and any time in VFP when we do a

copy to ..\myPath\test.xls type xls

that user name is present. Any thoughts?

[image]https://user-images.githubusercontent.com/18038772/202302103-00bde2fb-54d6-4de3-a3e9-baaccfcc3228.png [image]https://user-images.githubusercontent.com/18038772/202302665-8096c2a5-bd41-443b-adad-c8d6d32051da.png

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/76, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33LNCFQO4P2O5FJ7UJ3WIVJ5NANCNFSM6AAAAAASCWRRAI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

srrbach commented 1 year ago

Hi Greg,

It's not generating an 'error' per se. It's saving out the file path / name I pass in but the permissions are missing. I just see the error in the browser after trying to navigate to the file created (trying to download it). If I manually set the file it works perfect.

I also found if I do: LOCAL m.cmd m.cmd = 'RUN icacls "' + m.pathAndFileName + '" /grant "Authenticated Users:RX"' && read and execute &cmd That fixes it / sets the permission the only downside is you have to be running with windows admin rights to do this. it's just really weird that it's missing altogether when it's there with the copy to command with VFP

Scott

ggreen86 commented 1 year ago

Scott--

Thank you for the quick response. I just tried it by creating an export and checked the file permissions -- it has the Authenticated Users listed; however, without the setting for Full Control (both allow and deny are blank). Is this what you are also getting when you create a xlsx file?

[cid:1d7f3251-e04e-4fb1-8c40-81fdeb2d8abc]

The xlsx file is being created using the Shell.Application to zip the files which is then renamed to xlsx extension. You could sub-class the class and then implement your own AddFilesToZip method using an alternative solution to zip the files. That might solve the problem.

Greg


From: srrbach @.> Sent: Wednesday, November 16, 2022 5:23 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Comment @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] File Permissions (Issue #76)

Hi Greg,

It's not generating an 'error' per se. It's saving out the file path / name I pass in but the permissions are missing. I just see the error in the browser after trying to navigate to the file created (trying to download it). If I manually set the file it works perfect.

I also found if I do: LOCAL m.cmd m.cmd = 'RUN icacls "' + m.pathAndFileName + '" /grant "Authenticated Users:RX"' && read and execute &cmd That fixes it / sets the permission the only downside is you have to be running with windows admin rights to do this. it's just really weird that it's missing altogether when it's there with the copy to command with VFP

Scott

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/76#issuecomment-1317753561, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33M3NTRRLWBUQQOSAS3WIVNGLANCNFSM6AAAAAASCWRRAI. You are receiving this because you commented.Message ID: @.***>

srrbach commented 1 year ago

Greg,

No. That's not what I'm seeing. The 'Authenticated Users' is missing altogether. I did grab the version 32 release and not the 34 beta, so maybe that makes a difference? Would you consider the 34 beta stable enough for production and I should grab it?

ggreen86 commented 1 year ago

Scott--

I tested with the 34 beta and that is the version that I am using in my applications. It is stable; however, there is a condition in the export from a grid that is addressed by Doug Hennig -- see his issue that he submitted. In his submittal, he provides the code to fix the condition. I have not had time to work on this class as VFP is not my primary job (it is more of a hobby). Later next month I should get some time that I can devote to the class.

Greg


From: srrbach @.> Sent: Wednesday, November 16, 2022 5:46 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Comment @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] File Permissions (Issue #76)

Greg,

No. That's not what I'm seeing. The 'Authenticated Users' is missing altogether. I did grab the version 32 release and not the 34 beta, so maybe that makes a difference? Would you consider the 34 beta stable enough for production and I should grab it?

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/76#issuecomment-1317776009, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33O4HCUXZSCTVST5PW3WIVP5RANCNFSM6AAAAAASCWRRAI. You are receiving this because you commented.Message ID: @.***>

ggreen86 commented 1 year ago

Scott--

The only other thought I have on a possible cause of the missing 'Authenticated Users' is possibly where are you saving to? I was saving to a local drive on the machine when I have the permissions set. However, I just did a test to save to a network drive and the security tab is missing. See below:

[cid:6ff11f34-9ce9-4087-bd7d-51bc3c2341a4]

I would guess that this behavior is being controlled by Windows (I have 10 installed) since the same code is being executed each time.

Greg


From: srrbach @.> Sent: Wednesday, November 16, 2022 5:46 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Comment @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] File Permissions (Issue #76)

Greg,

No. That's not what I'm seeing. The 'Authenticated Users' is missing altogether. I did grab the version 32 release and not the 34 beta, so maybe that makes a difference? Would you consider the 34 beta stable enough for production and I should grab it?

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/76#issuecomment-1317776009, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33O4HCUXZSCTVST5PW3WIVP5RANCNFSM6AAAAAASCWRRAI. You are receiving this because you commented.Message ID: @.***>

srrbach commented 1 year ago

Hi Greg,

Thanks for the info. Unfortunately I am saving to a folder on my C: drive. I've tested both in fullpath('') and another directory but still on my c: drive and I get the same thing. I think I've got a temp fix for now with the code I posted before running icalcs to set file permissions.

I did not realize that an .xlsx file is basically just a zip file. Learn something new. Thanks again for your work on this class!

ggreen86 commented 1 year ago

Closing issue; cannot reproduce